Google on-campus hiring test 2022 Solutions

Поділитися
Вставка
  • Опубліковано 15 січ 2025

КОМЕНТАРІ • 43

  • @vaalarivan_p
    @vaalarivan_p 6 місяців тому +1

    Are the problems in Google oa sorted in the order of their difficulties?

  • @Anonymous____________A721
    @Anonymous____________A721 3 місяці тому +1

    Are these really google qns?
    All are medium
    I wish i would get these😅

  • @rohitrout6450
    @rohitrout6450 2 роки тому +3

    P4 is such an amazing question😍

  • @K_CO_ManjeetVats
    @K_CO_ManjeetVats 2 роки тому +7

    Hi bhaiya , I am not able to solve a single problem in Google coding round .I solved around 380 problems on leetcode . Bhaiya , i want to ask then how should i practice so that i am able to solve the problem. I know algorithm (like dp,greedy ) also know data structure (graph,trees) and solved medium level problem on them. But ,now i am frustrated that i am practicing but not able to solve problems. Please help

  • @aayushgupta1711
    @aayushgupta1711 2 роки тому +5

    in problem 1
    if on a path some value has occured more than half the nodes lying on that path.. then the remaining nodes would surely not satisfy the condition
    so I guess question boils down to finding simple path consisting of the nodes of value same as a root

  • @PIE_1e9
    @PIE_1e9 2 роки тому +1

    Thanks for this video❤️

  • @focus15624
    @focus15624 2 роки тому +2

    Hi. Can u advice me, if candidate master level is enough to crack Google?

  • @vaibhavkaura2136
    @vaibhavkaura2136 2 роки тому +8

    Can you plzz do today's leetcode contest too, it was bit difficult than usual
    Thankyou for the solutions

  • @tirthsuthar6818
    @tirthsuthar6818 2 роки тому

    I Guess no need to do trie solution in 2 question of string because it was said that the value of n*k
    map mp;
    for(int i=0;i

    • @Harisamsharma
      @Harisamsharma  2 роки тому +2

      This won't work because every string will have k prefixes and the total length of all prefixes of a string will be around k^2, so the total length of all prefixes will be nk^2. So it should MLE if you try to maintain a map.

  • @vaibhaves
    @vaibhaves 2 роки тому +3

    We can also do problem 3 with merge sort approach

  • @kunalbabbar7399
    @kunalbabbar7399 2 роки тому +5

    for problem 1 can we maintain max cnt and chk if its greater than 1/2 of curr_len instead of maintaining a multiset?

  • @hell-o8470
    @hell-o8470 2 роки тому

    what was the cf rating difficulty rating for problem P4 special paths?

    • @Harisamsharma
      @Harisamsharma  2 роки тому

      1800 I would say

    • @hell-o8470
      @hell-o8470 2 роки тому

      ​@@Harisamsharma And what could be the rating of last problem Partition string?
      And thanks for this video.
      Isn't last problem easier compared to 2nd last?

    • @samagrapathak3854
      @samagrapathak3854 2 роки тому

      @@hell-o8470 1800 vo merse ho gai thi i am specialist

  • @kshitizjaiswal6933
    @kshitizjaiswal6933 2 роки тому +1

    Prefix sum thing can be done with a pointer and single variable too

  • @eusebiu1050
    @eusebiu1050 2 роки тому

    Nice explanations. Btw, I see that you have a dark theme for chrome that changes everthing to dark, even codeforces logo as I saw, which is awsome. How did you setup that?

  • @nandapavan9987
    @nandapavan9987 2 роки тому

    in probelm 5 for dp[i][j] we also need to check whether jth character is even right??

  • @leviackerman9882
    @leviackerman9882 2 роки тому +2

    how to solve good paths if the path don't always start from root ie it can start and end anywhere?

  • @ShubhamKumar-me7xy
    @ShubhamKumar-me7xy 2 роки тому +1

    You can solve problem 1 in O(n), anyway it was unnecessary :)

  • @YashRaj-bn7du
    @YashRaj-bn7du 2 роки тому

    hello , Can u upload today google question test and solution

  • @UtkarshAgarwal-YearBTechMining
    @UtkarshAgarwal-YearBTechMining 2 роки тому +1

    i think you wrote a little too much code for the last problem ..this much also satisfies i thinkm though the idea is same
    int sol_2(string s, int n, int m, int k)
    {
    vector dp(n + 1, vector(k + 1));
    vector pref(n + 1, vector(k + 1));
    for(int i=0;i

  • @jeevanalexen
    @jeevanalexen 2 роки тому

    in problem c, we can't use lowerbound to count number of pairs?

  • @sumitprajapati821
    @sumitprajapati821 2 роки тому +2

    For problem D: special path.
    I did the following . I don't know if its correct. was working on samples + looked intuitive.
    Root the tree at node 1.
    For each node "i" ,let up[i] = index of the ancestor of i closest to root.( the blocking points are the node where the value is greater than val[i])
    Now I claim that two nodes i and j, such that val[i] = val[j] will form special path if and only if up[i] = up[j]
    So we can create a mapmp;
    and do mp[{val[i],up[i]}]++;
    and finally added the NC2 to our answer for each value in the map.
    the up array can be calculated using binary lifting (there may be a some easier way).
    Worked out example.
    Consider the tree in the sample
    (1-base indexing}
    up[] = {1,1,1,3,1,1}
    map will look like
    {3,1} -> 3
    {2,1} -> 2
    {1,3} -> 1
    so ans=3C2 + 2C2 + 1C2 = 3+1+0 = 4.
    Do let me know, if there exist a counter example.

  • @joydeepdas4105
    @joydeepdas4105 2 роки тому +2

    In which colleges did it happen

  • @sidharthdhiman4522
    @sidharthdhiman4522 2 роки тому

    bhaiya this policy based data structures include statement is not working on my vs code what should I do ?

    • @Harisamsharma
      @Harisamsharma  2 роки тому +2

      A quick hack is to use an online ide, for example codechef's ide

    • @yogeshagarwal403
      @yogeshagarwal403 2 роки тому

      @@Harisamsharma will these policy based data structures include statement works in online assessment tests?, like on hackerearth , hackerrank etc

    • @Harisamsharma
      @Harisamsharma  2 роки тому

      @@yogeshagarwal403 yes, they do.

    • @VishalKumar-bx4rn
      @VishalKumar-bx4rn 2 роки тому

      There is a video by priyansh agarwal on ordered_set usme he will say how to fix that error check that video

    • @sidharthdhiman4522
      @sidharthdhiman4522 2 роки тому

      @@VishalKumar-bx4rn i did the same thing but there is still issue , it gets terminated

  • @ankushgupta2528
    @ankushgupta2528 2 роки тому

    In Problem 3, after buiding 'A', can't we use binary search to count?

    • @jeevanalexen
      @jeevanalexen 2 роки тому

      that is what I thought

    • @Harisamsharma
      @Harisamsharma  2 роки тому +3

      You can't sort the array, since we need to satisfy i

  • @Mutant23
    @Mutant23 2 роки тому

    can you provide dsu template

  • @dennyage4791
    @dennyage4791 2 роки тому

    Bro which editor you are using in this video

  • @Live-hh6li
    @Live-hh6li 2 роки тому

    Thanks
    If you find more of such problems
    Please post videos
    They will be really helpful

  • @naha_ne_ja_nahane
    @naha_ne_ja_nahane 2 роки тому

    Thanks

  • @shivangupadhyay8002
    @shivangupadhyay8002 2 роки тому

    can you please provide link to that file