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

Комментарии • 48

  • @HimanshuSingh-hd8of
    @HimanshuSingh-hd8of 3 года назад +31

    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

  • @joydeb8202
    @joydeb8202 3 года назад +37

    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 ; )

  • @paragggoyal1552
    @paragggoyal1552 Год назад +1

    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.

  • @debdutsaha4316
    @debdutsaha4316 3 года назад +8

    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

  • @techniczoid7268
    @techniczoid7268 3 года назад +5

    you people are amazing , plz make video on different problems that are frequently asked in product based companies on DSA plz plz asap

  • @entertainmentiseverything8650
    @entertainmentiseverything8650 3 года назад +11

    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.

  • @himanibisht9300
    @himanibisht9300 3 года назад +6

    For second diagonal sum should be sum+=a[i] a[n-i-1];

    • @jagankumarpatra4960
      @jagankumarpatra4960 Год назад

      first put in hashset if the value is not in hashset then only add it

  • @pythonworld9080
    @pythonworld9080 3 года назад +7

    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

    • @gouthamr8214
      @gouthamr8214 3 года назад

      Space complexity will be O(1) for this approach

    • @ab4io
      @ab4io 8 месяцев назад

      Exactly what I thought

  • @my_j.a.r.v.i.s.
    @my_j.a.r.v.i.s. 2 года назад +5

    Interviewer looks younger than candidate

  • @arulantony2137
    @arulantony2137 2 года назад +1

    sort quick sort O(logn) and iterate O(1),
    use linked hash map space and time O(n) and O(n)

  • @utkarshsingh6778
    @utkarshsingh6778 3 года назад +4

    Nice session sir
    Sir we want more sessions based on DSA 🙏

  • @RP-qv9sc
    @RP-qv9sc 3 года назад +2

    1st question absolute brute force is to run 3 loops

  • @dhruvmaindola673
    @dhruvmaindola673 2 года назад +2

    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?

    • @depression_plusplus6120
      @depression_plusplus6120 Год назад

      aaababc
      Naive approach will fail at index 4 as per his logic since he'll start his inner loop from index 5

  • @djnoddy4709
    @djnoddy4709 Год назад

    Sir can I Get A Mock Video On DSA person talking to customer about home loan,business loan,LAP and DOD Please

  • @alkanedust3848
    @alkanedust3848 3 года назад +4

    Interviewer looks like Guddu Bhaiya(Ali Fazal) 😁

  • @harshdeepsinghful
    @harshdeepsinghful 3 года назад

    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

  • @top5things968
    @top5things968 2 года назад +1

    Great Video !

  • @AnubhavGargAnu
    @AnubhavGargAnu 2 года назад +1

    27:13 Interviewee asked a genuine question about parent pointer. Interviewer couldn't understand it !

    • @atharvshelar5947
      @atharvshelar5947 10 месяцев назад

      Could you explain it more, I want to understand what he was asking I'm a beginner at the moment🙏🏻🕉️

  • @gauravkungwani
    @gauravkungwani 3 года назад +7

    Last question was i think minimum spanning tree ?? What do u guys think ?

  • @user-pp1ud4nf5n
    @user-pp1ud4nf5n Год назад +1

    Pretty much pretty much pretty much

  • @patricksakala5791
    @patricksakala5791 Год назад +2

    //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

  • @joshuamuanlal6936
    @joshuamuanlal6936 Год назад

    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 😂😂😂

  • @nitinnathgiri3246
    @nitinnathgiri3246 2 года назад +1

    first loop in first question ..may give you an error

  • @piyushaggarwal9484
    @piyushaggarwal9484 Год назад

    more videos like that shoukd be uploaded

  • @the_it_guy4126
    @the_it_guy4126 Год назад

    pl tell who is Interviewer

  • @horusstatus5212
    @horusstatus5212 3 года назад

    🙏

  • @rinkusaini7056
    @rinkusaini7056 3 года назад

    🔥🔥🔥🔥

  • @Im_RajSingh
    @Im_RajSingh Год назад

    The interviewer is not good. He is just rushing not seeing that the candidate is checking cases

  • @sahilsaxena8374
    @sahilsaxena8374 3 года назад

    Sir how can I give this mock interview?

  • @sunnykumar-lb6kr
    @sunnykumar-lb6kr 2 года назад

    Please create a moke interview with Mr. Striver....

  • @allwindsouza9595
    @allwindsouza9595 3 года назад +2

    Not gonna lie .. jeswin dum af 😐

    • @allwindsouza9595
      @allwindsouza9595 3 года назад +5

      He solved the tree question pretty quick ... He ain't dum .. I take that back 😅

    • @vinaykenguva362
      @vinaykenguva362 3 года назад +13

      Would be better to delete comment rather than taking it back.

    • @rheumaticharm9551
      @rheumaticharm9551 3 года назад +8

      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.

  • @chanchalsoni6571
    @chanchalsoni6571 Год назад

    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

  • @nitinnathgiri3246
    @nitinnathgiri3246 2 года назад

    first loop in first question ..may give you an error