25:00 code def wordwisereverse(s1): res=''" s=s1.split(" ") for word in range(len(s)-1,-1,-1): res+=s[word] res+=" " return res s1="hi how are you" print(wordwisereverse(s1))
For the question "Binary Operations On Strings" we can code in simpler way right? like the below code . as it will be short & easier to understand. Java Code: import java.util.*; public class Main{ public static void main(String[]args){ Scanner sc=new Scanner(System.in); String str1=sc.next(); String str2=sc.next(); String op=sc.next(); String res=""; for(int i=0;i
third code with functions def replace_char(str,ch1,ch2): result='' for i in str: if i==ch1: result= str.replace(i,ch2) elif i==ch2: result= str.replace(i,ch1) else: result ==i return result print(replace_char("Hello, World!", "l", "a"))
In "reversing the words in a sentence" there is a small error in the code...In line 21 of your github JAVA code it should be {i - -} in the for loop while retrieving the elements from the stack. You have written i ++.
@@PrimeCoding19 #include #include #include // For reverse function using namespace std; string reverseWords(string s) { int n = s.length(); int left = 0, right = 0; // Reverse the entire string first reverse(s.begin(), s.end()); // Now reverse each word in the reversed string while (right < n) { // Skip spaces while (right < n && s[right] == ' ') right++; left = right; // Find the end of the word while (right < n && s[right] != ' ') right++; // Reverse the word reverse(s.begin() + left, s.begin() + right); } return s; } int main() { string s = "welcome to code"; cout
hello sir i have question that "we need to only write the logic or code from scratch during interview??, ya it will like leetcode just put the logic and submit the answer??"
@@Vedantbhosale123 Not just one, we took questions from many websites. Lucky for you, you don't have to worry here and there and all the questions are ready for you!
25:00 code
def wordwisereverse(s1):
res=''"
s=s1.split(" ")
for word in range(len(s)-1,-1,-1):
res+=s[word]
res+=" "
return res
s1="hi how are you"
print(wordwisereverse(s1))
first coding solution in python:
def isPalindrome(string):
flag = False
if string == string[::-1]:
flag = True
return flag
def palindrome(s):
start = 0
end = len(s)-1;
while(start < end):
if(s[start]!=s[end]):
return False
else:
return True
s=input()
print(palindrome(s))
What an explanation. Grt presentation. Thanks for guidance
IT WAS Very HELPFUL VIDEO ...
Sir Could u please make one video on dynamic Programming in PYTHON
really helpful!!! assingnmentpublic class Main
{
public static void main(String[] args) {
String s="banana";
char a='a';
char b='b';
System.out.println(rep(s,a,b));
}
public static String rep(String s,char a,char b){
//return s.replace(a,b);
StringBuilder p=new StringBuilder();
for(int i=0;i
For the question "Binary Operations On Strings" we can code in simpler way right? like the below code . as it will be short & easier to understand.
Java Code:
import java.util.*;
public class Main{
public static void main(String[]args){
Scanner sc=new Scanner(System.in);
String str1=sc.next();
String str2=sc.next();
String op=sc.next();
String res="";
for(int i=0;i
@@ThroughMyLenz09 yes!
thank u so much
Sir, U R A GREAT TEACHER for us, please make videos on Capgemini campus coding. please sir.
for anagrams question time complexity is o(n log n) if we used sorted function
1. String Palindrome -- JAVA Code:-
public static boolean isPalindrome(String word){
String result ="";
for(int i =0; i< word.length(); i++){
char ch = word.charAt(i);
result = ch + result;
}
return result.equals(word);
}
str=input()
res=" "
for i in range(len(str)):
if str[i]=='a':
res+='b'
else:
res+=str[i]
print(res)
Well explained and helpful. Thanks
Video is very helpful Thank you ..... Assignment done
third code with functions
def replace_char(str,ch1,ch2):
result=''
for i in str:
if i==ch1:
result= str.replace(i,ch2)
elif i==ch2:
result= str.replace(i,ch1)
else:
result ==i
return result
print(replace_char("Hello, World!", "l", "a"))
Avoid use of inbuilt functions!
Will this code work for the last question? def reverseSentence(s):
a = s.split()
i = 0
j = len(a) - 1
while i < j :
a[i],a[j] = a[j], a[i]
i+=1
j-=1
return ' '.join(a)
In "reversing the words in a sentence" there is a small error in the code...In line 21 of your github JAVA code it should be {i - -} in the for loop while retrieving the elements from the stack. You have written i ++.
It is necessary that the input and output which is mentioned in the question should come exact.
public static String transformString(String str){
char ch[] = str.toCharArray();
for(int i=0; i
Reverse Words in String :
s = 'hello world'
lst = s.split()
lst = lst[::-1]
s = ' '.join(lst)
print(s)
can we use built-in functions such as .replace in 3 qn , or will it affect the online assessment
Avoid using inbuilt functions. But yes in OA you can use.
Do they check time and space complexity??
Good solutions
Share more videos like this
Bro make more videos on Accenture placement
bro for ase role the coding question will they ask harder one or easier one because on youtube people are uploading hard videos
Thank you so much
4:25 sliceing lo chepithey easy ga artham avuthundhi kadha
all questions are very easy anybody who solve leetcode daily he solve these questions in just 10-15 mins
please bring mindtree interview questions
Can we crack the accenture ASE role just by your videos..?
Yes
Reverse a string code
str= 'This Code Is Easy'
x=str.split()
y=[]
for i in reversed(x):
y.append(i)
d=' '.join(y)
print(d)
Last question is doubtful please check it once abnbnb will be the output also the question is much easier
You are linking this question to a Leetcode medium question.
but it's not like that. You will not find any uneven place here.
yes the output should be the one you mentioned
are we not allowed to use string functions in code. like sort() , reverse()?
You can use
@@PrimeCoding19 #include
#include
#include // For reverse function
using namespace std;
string reverseWords(string s) {
int n = s.length();
int left = 0, right = 0;
// Reverse the entire string first
reverse(s.begin(), s.end());
// Now reverse each word in the reversed string
while (right < n) {
// Skip spaces
while (right < n && s[right] == ' ') right++;
left = right;
// Find the end of the word
while (right < n && s[right] != ' ') right++;
// Reverse the word
reverse(s.begin() + left, s.begin() + right);
}
return s;
}
int main() {
string s = "welcome to code";
cout
Please provide code for last question
can we use built in functions in coding round
yes
hello sir i have question that "we need to only write the logic or code from scratch during interview??, ya it will like leetcode just put the logic and submit the answer??"
You must write your code without syntax errors from the beginning.
is STL aloud in accenture coding test compiler??
Yes
Ok thanks @@PrimeCoding19
Can we know from which website you got this questions
@@Vedantbhosale123 Not just one, we took questions from many websites.
Lucky for you, you don't have to worry here and there and all the questions are ready for you!
sir next video string question ka aa gya kya ????
Playlist dekho 90% questions solved krdiye ha baki hojayenge. try it
@@PrimeCoding19 bhaiya string par 1 hi video dikha mujhe...
accenture mai javaScript mai DSA allowed hain kya ??
I guess no
No
helpul. Thanks
sir This is oncampus coding questions
Both
public class ReplaceChars {
public static void main(String[] args) {
String input = "banana";
String modified = input.replace('a', '#')
.replace('b', 'a')
.replace('#', 'b');
System.out.println("Original: " + input);
System.out.println("Modified: " + modified);
}
}
Can we use builtin functions like sort() in accenture coding test
Yes, you can