Live Mock Interview | DSA Questions: Product-Based Companies
HTML-код
- Опубликовано: 16 сен 2024
- With our mock interview series, we aim to familiarise you with the kind of questions asked, latest trends & feedback from our mentors.
In this webinar, Mr. Dhananjay Mishra, a mentor at GeeksforGeeks would be interviewing Jasvin James, a Systems Engineer at TCS Digital.
𝗧𝗵𝗲 𝗚𝗲𝗲𝗸𝘀 𝗦𝘂𝗺𝗺𝗲𝗿 𝗖𝗮𝗿𝗻𝗶𝘃𝗮𝗹 𝗶𝘀 𝗻𝗼𝘄 𝗟𝗜𝗩𝗘! 𝗚𝗲𝘁 𝗮𝗺𝗮𝘇𝗶𝗻𝗴 𝗱𝗶𝘀𝗰𝗼𝘂𝗻𝘁𝘀, 𝗽𝗮𝗿𝘁𝗶𝗰𝗶𝗽𝗮𝘁𝗲 𝗶𝗻 𝗰𝗼𝗻𝘁𝗲𝘀𝘁𝘀 & 𝘄𝗶𝗻 𝗯𝗶𝗴 𝘁𝗵𝗶𝘀 𝘄𝗲𝗲𝗸: practice.geeks...
For an ad-free experience, personal notes, discounts & much more, join our Premium community: premium.geeksf...
Follow us on our social media handles for updates, programming humor & all things geeky-
Instagram: / geeks_for_geeks
Twitter: / geeksforgeeks
#GeeksSummerCarnival #LIVE #MockInterview
Hello Sir, I generally don not commented on videos but this time I must say these sessions are really helpful and they are making us aware of the situations which we are going to face in real interviews Thankyou so much for putting your efforts and energy to help us out
Just Awesome...
Even i was socked when he said that space complexity is 0(1) ; ) but then when he explained..... i was literally surprised.
Even the Interviewer got socked ; )
😂😂😂
last question is not at all Dijkstra in Dijkstra we achieve distances to all the nodes from starting node. last question would have been Dijkstra only when the we would have visited back to original node after visiting the current node everytime. basically node0->nodeX->node0->nodeY->node0... something like that for all the nodes.
Hi interviewer there can be an enhancement in the first coding question...there could be Integer array of 26 length and then we can use to store the frequency to get the update... so it will be O(1) space complexity
you people are amazing , plz make video on different problems that are frequently asked in product based companies on DSA plz plz asap
For the 1st quuestion code shown in 17.22 min in the video will get a run time error.
Because the line count_dict[I] += 1 will catch a error when it check for any character which is not present in the dictionary yet.
For second diagonal sum should be sum+=a[i] a[n-i-1];
first put in hashset if the value is not in hashset then only add it
In first one , we can make a dictionary to keep count of element frequency and then again iterating through the array to find the element whose freq is 1 and then break
Space n
Time n
Space complexity will be O(1) for this approach
Exactly what I thought
Interviewer looks younger than candidate
sort quick sort O(logn) and iterate O(1),
use linked hash map space and time O(n) and O(n)
quicksort has O(nlogn) tc
Nice session sir
Sir we want more sessions based on DSA 🙏
1st question absolute brute force is to run 3 loops
why would the naive approach be wrong? if we do not find that character in the second loop we will just return element at the index of the first loop. else move ahead. why wouldn't that work?
aaababc
Naive approach will fail at index 4 as per his logic since he'll start his inner loop from index 5
Sir can I Get A Mock Video On DSA person talking to customer about home loan,business loan,LAP and DOD Please
Interviewer looks like Guddu Bhaiya(Ali Fazal) 😁
Will this how we need to understand the hints...his hint was clear that we need a linkedhaspmap to maintain the order for the the first character with count 1
Great Video !
27:13 Interviewee asked a genuine question about parent pointer. Interviewer couldn't understand it !
Could you explain it more, I want to understand what he was asking I'm a beginner at the moment🙏🏻🕉️
Last question was i think minimum spanning tree ?? What do u guys think ?
Yes
Looks life weighted dfs to me
Yes exactly
Yes same as network delay time on leetcode
@@lordbaggot dfs doesn't able to find the shortest path.
Pretty much pretty much pretty much
//Quetion one
public static char uniqueCharInStirng(String string) {
int helper = 0;
for(int i = 0; i < string.length(); i++) {
helper = helper ^ (int)(string.charAt(i)); // just using xor operator sisce its commutative
// System.out.println(helper);
}
// System.out.println((int)('e'));
return (char)(helper);
}
//Quetion 2
public static int sumOfDiaginal(int[][] matrix) {
int left = 0;
int right = matrix[0].length -1;
int sum = 0;
for(int i = 0; i < matrix.length; i++) {
if(right > left) {
// System.out.println(left +" ---"+ right + " in array "+ i);
sum += matrix[i][left] + matrix[i][right];
left++; right--;
}
else if(right < left) {
// System.out.println(left +" ---"+ right+" in array "+ i);
sum += matrix[i][left] + matrix[i][right];
left++; right--;
}
else {
sum += matrix[i][left];
left++; right--;
}
}
return sum; // excellent work! O(n) time complexity @Patrick Sakala, Zambia
}
//Question 3, Two functions, one for finding the even nodes and a helper function for finding the sum for grandchildren
// my tree definition
class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode(int x) { val = x; }
}
public static int sumOfNodesWithEvenGrandParent(TreeNode root) {
if(root == null) {
return 0;
}
if(root.val % 2 == 0) {
// System.out.println("am here");
return getSumOfGrandChildren(root,2) + sumOfNodesWithEvenGrandParent(root.left) + sumOfNodesWithEvenGrandParent(root.right) ;
}
return sumOfNodesWithEvenGrandParent(root.left) + sumOfNodesWithEvenGrandParent(root.right);
}
private static int getSumOfGrandChildren(TreeNode root, int depth) {
if(root == null) {
return 0;
}
if(depth == 0) {
return root.val;
}
else {
return getSumOfGrandChildren(root.left, depth-1) + getSumOfGrandChildren(root.right, depth-1);
}
}
// easy staff!!!!!!!!!!!!!!!! author Patrick, java is sweeet
def unique(s):
l=len(s)
sel=[]
for x in range(l):
temp=s[x]
it=0
for y in range(l):
if temp==s[y]:
it=it+1
if it==1:
sel.append(temp)
print(it)
print(sel)
unique("aabbedabdg")
Lol my answer 😂😂😂
first loop in first question ..may give you an error
more videos like that shoukd be uploaded
pl tell who is Interviewer
🙏
🔥🔥🔥🔥
The interviewer is not good. He is just rushing not seeing that the candidate is checking cases
Sir how can I give this mock interview?
Please create a moke interview with Mr. Striver....
Not gonna lie .. jeswin dum af 😐
He solved the tree question pretty quick ... He ain't dum .. I take that back 😅
Would be better to delete comment rather than taking it back.
Even I thought at the first question. But the fact is, he is being interviewed infront of the whole world. Which definitely affects his performance and must be nerve wrecking.
import java.util.HashMap;
public class FirstUniqueCharacter {
public static char findFirstUniqueCharacter(String str) {
// Create a HashMap to store the frequency of each character
HashMap frequencyMap = new HashMap();
// Iterate through the characters of the string and count their frequency
for (char ch : str.toCharArray()) {
frequencyMap.put(ch, frequencyMap.getOrDefault(ch, 0) + 1);
}
// Iterate through the characters again and return the first character with frequency 1
for (char ch : str.toCharArray()) {
if (frequencyMap.get(ch) == 1) {
return ch;
}
}
// If no unique character is found, return a default character or throw an exception
throw new RuntimeException("No unique character found");
}
public static void main(String[] args) {
String str = "abracadabra";
char firstUniqueChar = findFirstUniqueCharacter(str);
System.out.println("First unique character: " + firstUniqueChar);
}
} 1st unique character
first loop in first question ..may give you an error