Senior Software Engineer Takes on a Meta Phone Screen!

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

КОМЕНТАРІ • 90

  • @jamesperaltaSWE
    @jamesperaltaSWE  3 дні тому +6

    Shoutout to leetcode.com/ for providing the platform! You will need to pay for premium to access this feature but it is well worth it!

  • @patpajmma7420
    @patpajmma7420 4 дні тому +29

    Holy shit, Meta just hire the man already

    • @jamesperaltaSWE
      @jamesperaltaSWE  4 дні тому +3

      LOL

    • @shkhamd
      @shkhamd 3 дні тому +5

      not until after another 20 rounds with exponentially increasing difficulty at each round 😂😂

    • @jamesperaltaSWE
      @jamesperaltaSWE  3 дні тому +3

      @shkhamd fr 😂😂 it be like that

  • @Jae77
    @Jae77 День тому +7

    i'm confident i can solve both problems in under 10 minutes with my eyes closed.
    these days the problem isn't passing the technical. it's getting one in the first place. job hunt is rough 😞

    • @jamesperaltaSWE
      @jamesperaltaSWE  День тому +1

      It’s rough forsure :// where are you based and how’s your resume? Maybe I can give some advice on that.

    • @Nikola79797
      @Nikola79797 11 годин тому +1

      Hey, would you like to review my resume and give me some tips?🙂 any advice would help me

    • @jamesperaltaSWE
      @jamesperaltaSWE  11 годин тому

      @Nikola79797 I’m down! Can you send it to me in the discord? discord.gg/9hS5tqnVSs

    • @Nikola79797
      @Nikola79797 11 годин тому +1

      @ sure! Thanks

    • @Jae77
      @Jae77 9 годин тому

      @jamesperaltaSWE I think I replied earlier today with a link, pretty sure yt removed it. I'll send it through discord as well, many thanks!

  • @Sharky-c3z
    @Sharky-c3z 5 днів тому +8

    In the 2nd question can we this
    For every node starting from root find the height of left subtree and right subtree .
    Now, if height of left subtree is more this means deepest node is in left one and we move to that tree and vice versa.
    And move recursively untill height of both tree becomes equal then just return that node.
    I think that might work and it's easy to 😀😀

    • @Sharky-c3z
      @Sharky-c3z 5 днів тому +1

      A reply would be appreciated 😅

    • @jamesperaltaSWE
      @jamesperaltaSWE  5 днів тому +1

      @@Sharky-c3z hmm were not looking for the deepest node but for a node that contains all of the deepest nodes under it. There can be multiple nodes that contain the deepest nodes and we need to capture the lowest one in the tree. If we just had to return any we would just return the root everytime. Let me know if that makes sense.

    • @Sharky-c3z
      @Sharky-c3z 5 днів тому +1

      ​@@jamesperaltaSWE it is pre- requisite that leaf nodes are always the deepest node and height of a tree is nothing but a traversal from a specific node to its deepest descendant leaf node so this solution might work. 😀

    • @Sharky-c3z
      @Sharky-c3z 5 днів тому +1

      @@jamesperaltaSWE Moreover just submitted my code and it worked ;)
      Have a look ,Sorry it's in c++🥲
      class Solution {
      public:
      TreeNode* ans = NULL;
      int height(TreeNode* root)
      {
      if(!root) return 0;
      int lh = 1 + height(root->left);
      int rh = 1 + height(root->right);
      return max(lh , rh);
      }
      TreeNode* helper(TreeNode* root)
      {
      if(!root) return NULL;
      if(!root->left && !root->right) return root;
      int lh = height(root->left);
      int rh = height(root->right);
      if(lh == rh) return root;
      if(lh > rh) return helper(root->left) ;
      return helper(root->right);
      }
      TreeNode* subtreeWithAllDeepest(TreeNode* root) {
      return helper(root);
      }
      };

    • @Sharky-c3z
      @Sharky-c3z 5 днів тому +1

      @@jamesperaltaSWE Just coded it out and it worked ;)
      Have a look
      class Solution {
      public:
      int height(TreeNode* root)
      {
      if(!root) return 0;
      int lh = 1 + height(root->left);
      int rh = 1 + height(root->right);
      return max(lh , rh);
      }
      TreeNode* helper(TreeNode* root)
      {
      if(!root) return NULL;
      if(!root->left && !root->right) return root;
      int lh = height(root->left);
      int rh = height(root->right);
      if(lh == rh) return root;
      if(lh > rh) return helper(root->left) ;
      return helper(root->right);
      }
      TreeNode* subtreeWithAllDeepest(TreeNode* root) {
      return helper(root);
      }
      };

  • @philipsoerensen
    @philipsoerensen 2 дні тому +6

    I've worked with this guy and he's insanely good!

    • @jamesperaltaSWE
      @jamesperaltaSWE  2 дні тому +1

      @@philipsoerensen you as well!! And congrats on raising $2 million for your AI Startup 🚀

  • @gn0my
    @gn0my 4 дні тому +6

    the first problem, literally one line: set(nums).intersect(set(nums2))
    is that rly what faang interview is like? swe for 5 yrs. I did the second one fairly quick too..

    • @jamesperaltaSWE
      @jamesperaltaSWE  3 дні тому +2

      First question is a bit easy your right but I think a lot of candidates would get stumped on Q2

    • @fadsa342
      @fadsa342 3 дні тому +3

      I don't work for a faang or faang adjacent company but if a candidate returned your solution I'd push them to solve it without using utility functions. I assume faang interviews won't make you write a bubble sort from scratch but won't accept certain utility functions in answers

    • @jamesperaltaSWE
      @jamesperaltaSWE  3 дні тому +2

      @@fadsa342 I’ve done FAANG interviews before and have lots of friends in FAANG right now and most will ask you 2 questions in a 45 - 60min interview. The first is usually an easy warm up that they’ll expect you to breeze through before asking you a harder question. Since this is just the warmup question I think this would suffice as long as you can explain what’s happening under the hood.

    • @jamesperaltaSWE
      @jamesperaltaSWE  3 дні тому +1

      @@fadsa342 but also I don’t think they’ll ask something this easy haha

  • @Dom-zy1qy
    @Dom-zy1qy 4 дні тому +6

    I wish it was standard practice for leetcode style problems to discourage the usage of utility methods in languages' standard libraries.
    Using high-level functions, like the intersection method, to solve low-level problems seems antithetical to the essence of leetcode/DS&A problems.
    Interviewers want to see how you work through problems and think. For trivial problems like the intersection of two arrays, it would probably be more beneficial if you wrote the intersection method from scratch. For more complex problems, using helper methods is fine. It really only seems silly in the context of easy problems.
    However in normal day SWE doing this would probably make a lot of other devs mad at you, so maybe youd have to explicitly tell the interviewer why you decided to implement X method from scratch instead of using the built-in function.

    • @jamesperaltaSWE
      @jamesperaltaSWE  3 дні тому +1

      Ahh yup that makes sense. It would definitely be something you should discuss with the interviewer before implementing. I first talk about how I would do it manually and then decided to just use built-in functions but probably my interviewer would stop me there and tell me which one he preferred.
      But honestly if I didn’t want a candidate to use built-in functions I would create a variation of the problem where built-in functions wouldn’t be as useful.

  • @VamshiV-g9r
    @VamshiV-g9r 6 днів тому +3

    Hey i have a doubt...
    What if( in cpp)
    1) First see which array is larger.. Using If loop and storing it N
    2) take a unordered set (avg tc 0(1) for insertion) and copy down all the elements of that larger arrray of size N
    3) iterate through the smaller array and do
    mst.find(arr[i])
    4) if i dont find the element then i am gonna erase that element in the unordered set.
    5) copy down the elements to a list or array and return it...
    my TC-----> 0(larger array size)
    My SC-----> 0(2N)
    Your TC---> 0(nums1.size() +nums2.size())
    Your SC---> 0(3N)

    • @jamesperaltaSWE
      @jamesperaltaSWE  6 днів тому

      @@VamshiV-g9r think that works but sounds overly complicated

  • @davideluci5091
    @davideluci5091 3 дні тому +8

    now my algorithm and data structure course actually makes sense.

  • @Ved-vi2gb
    @Ved-vi2gb 3 дні тому +2

    W video as always
    Will you please make a video for dsa in python as there are not much resources out there on this

    • @jamesperaltaSWE
      @jamesperaltaSWE  3 дні тому +1

      @@Ved-vi2gb I have this playlist! ua-cam.com/play/PL1_cEA1Q0Z8-WO_mXqu8Nf0ObhxhqnBI-.html&feature=shared

    • @jamesperaltaSWE
      @jamesperaltaSWE  3 дні тому

      Will add more to it in the next couple of weeks

  • @LiamHayes-c4y
    @LiamHayes-c4y 2 дні тому +2

    another banger 🔥

  • @amanshrivastava7495
    @amanshrivastava7495 3 дні тому +2

    For second question just find the lowest common ancestor of first and last node of last level.

    • @jamesperaltaSWE
      @jamesperaltaSWE  3 дні тому

      @@amanshrivastava7495 ahh yeah your right that would probably work too! It wouldn’t work with any other two nodes but yup you’re right 🔥

    • @amanshrivastava7495
      @amanshrivastava7495 3 дні тому +1

      The two nodes of the last level which are farthest from each other (leftmost and right most) will cover all the intermediary parents of other nodes which are at last level. So subtree root will be the lca of these two left most and right most node.

    • @jamesperaltaSWE
      @jamesperaltaSWE  3 дні тому +2

      @@amanshrivastava7495 yup I agree it will work if you take the last and first node

  • @jaswanthgannamaneni8461
    @jaswanthgannamaneni8461 6 днів тому +3

    for the first question can we just use the inbuilt methods in an interview? is that accepted? in python.

    • @jamesperaltaSWE
      @jamesperaltaSWE  6 днів тому +2

      Yup I think in built is fine here. I wouldn’t mind if I was the one hosting the interview.

    • @deamooz9810
      @deamooz9810 4 дні тому +2

      could use the & operator to find intersection as well lol

    • @jamesperaltaSWE
      @jamesperaltaSWE  4 дні тому

      @ ohh interesting I was only familiar with ‘.intersection’

    • @storyofbo
      @storyofbo 3 дні тому +1

      During my interview at Meta they asked me not to for the sake of the interview. I would just ask though.

    • @jamesperaltaSWE
      @jamesperaltaSWE  3 дні тому +1

      @storyofbo ahhh okay I see! Makes sense thanks for the insight 😁

  • @dondahighhh12
    @dondahighhh12 9 годин тому +1

    lmao the Comments are lying talking about this is so easy
    actual engineers struggle to do this without studying Leetcode and DSA first

    • @jamesperaltaSWE
      @jamesperaltaSWE  7 годин тому +1

      Hahah yeah I agree these are hard 😭😭

    • @jamesperaltaSWE
      @jamesperaltaSWE  7 годин тому +1

      But yeah some people are saying it’s easy lmao they must be studying a lot. If you haven’t done leetcode in a while the second would be nearly impossible unless your really good at DSA

  • @michaelrodrigues6372
    @michaelrodrigues6372 3 дні тому +2

    Yoo James any tips to get better at coding bro? my problem solving skills are bad dude :(

    • @jamesperaltaSWE
      @jamesperaltaSWE  2 дні тому +1

      @@michaelrodrigues6372 practice makes perfect!! Just keep on grinding LeetCode questions and you’ll eventually get there 🙏 I was bad at one point also and after a few months of consistent effort I improved substantially.

    • @jamesperaltaSWE
      @jamesperaltaSWE  2 дні тому +1

      @@michaelrodrigues6372 try following these steps for something more prescriptive: ua-cam.com/video/i4dw_HAbNBI/v-deo.htmlfeature=shared

  • @Ved-vi2gb
    @Ved-vi2gb 3 дні тому +1

    Also upload more videos on teaching dsa

  • @Nat-d4p
    @Nat-d4p 4 дні тому +2

    Savage 🔥🔥

  • @dian_permana
    @dian_permana 4 дні тому +2

    i cannot eat if I understand this point, just sent to AI to solve this problem.

    • @jamesperaltaSWE
      @jamesperaltaSWE  4 дні тому +1

      @@dian_permana LOL yeah AI can probably solve this easy

    • @dian_permana
      @dian_permana 4 дні тому +1

      @@jamesperaltaSWE so what do you think bro? I am from Indonesia struggle with this point. Wasting time but in the same time everyone using AI 😀

    • @jamesperaltaSWE
      @jamesperaltaSWE  4 дні тому

      Are you asking if AI will replace Software Engineering?

    • @dian_permana
      @dian_permana 4 дні тому +1

      @@jamesperaltaSWE no, I want to know the trend in your country, how about fresher use this and impacted to career path in the future

    • @jamesperaltaSWE
      @jamesperaltaSWE  4 дні тому

      @@dian_permana Sorry I don’t understand the question completely. So you’re asking how a freshman can use AI?

  • @Grogu1999
    @Grogu1999 7 днів тому +4

    🔥🔥🔥

  • @qy-exotic7717
    @qy-exotic7717 13 годин тому +1

    nice

  • @johnperaltaCFA
    @johnperaltaCFA 7 днів тому +6

    😂 hmm lol maybe let’s do a mock interview on me in a couple of months and see how many negative indicators I have

    • @jamesperaltaSWE
      @jamesperaltaSWE  7 днів тому +1

      @johnperaltaCFA LOL bettt

    • @jamesperaltaSWE
      @jamesperaltaSWE  7 днів тому +1

      @johnperaltaCFA we can do the Bloomberg one

    • @johnperaltaCFA
      @johnperaltaCFA 7 днів тому +1

      😂 lol give me a prep plan and I’ll study it on the side

  • @likesofc
    @likesofc 6 днів тому +2

    Bem legal, gostei, vou tentar.
    Good, liked, I'll try

  • @Ninjafire300
    @Ninjafire300 2 дні тому +1

    class Solution {
    public:
    int depth(TreeNode*& root){
    return !root?0:max(depth(root->left),depth(root->right))+1;
    }
    TreeNode* subtreeWithAllDeepest(TreeNode* root) {
    if(!root) return nullptr;
    int left=depth(root->left);
    int right=depth(root->right);
    if(left==right) return root;
    if(left>right) return subtreeWithAllDeepest(root->left);
    else return subtreeWithAllDeepest(root->right);
    }
    };

    • @jamesperaltaSWE
      @jamesperaltaSWE  2 дні тому +1

      Let me try this I think it'll work

    • @jamesperaltaSWE
      @jamesperaltaSWE  2 дні тому +1

      There are definitely more succinct ways to solve this compared to what I did haha

  • @Caesar6310
    @Caesar6310 4 дні тому +2

    savage

  • @nim_a123
    @nim_a123 2 дні тому +1

    u was cheating

    • @jamesperaltaSWE
      @jamesperaltaSWE  2 дні тому +3

      how? I'm using a single monitor lol you can see everything I do there.

    • @nim_a123
      @nim_a123 2 дні тому +1

      @ ur head go left and see another monitor

    • @jamesperaltaSWE
      @jamesperaltaSWE  День тому

      @@nim_a123 just thinking haha trust me I don’t need to cheat