Google Coding Interview P2 | By Salesforce Engineer

Поділитися
Вставка
  • Опубліковано 17 жов 2024

КОМЕНТАРІ • 42

  • @SFDCFacts
    @SFDCFacts  4 роки тому

    ****FREE LWC COURSE VOUCHER*****
    Are you someone or do you know someone who recently appeared for a Salesforce Developer interview at Google/Amazon/Uber/Salesforce or any major product company?
    Then reach out to me at *sfdcfacts@**gmail.com* to share your interview experience and get access to LWC udemy course for FREE!!!!!

  • @MichaelJohnson-ot3if
    @MichaelJohnson-ot3if 2 роки тому +3

    Crazy thing is this can all be accomplished in a much more efficient manner with a few additions to the data model and a simple workflow (or few lines of trigger code if you must). I understand this is a coding interview, but I find far too often Salesforce developers(and developers in general) immediately start with over-engineered coding implementations as opposed spending some time thinking about the problem, and implementing a more simplistic elegant solution. I think an important follow up question may be "would you be able to implement this without code, and what are the pros and cons of each?" which will definitely give you some insight into how the developer approaches problems.

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

    Is there any video explaining the DSA roung at google for salesforce developers ? how hard the questions are?

  • @kirillhantayev9627
    @kirillhantayev9627 4 роки тому +9

    This problem has a very simple mathematical solution. Instead of retrieving all patients for an area just keep adding the number of cases to a custom field on the area. Than calculate the weighted average each time just with the trigger context - without doing any additional SOQL queries.

  • @venumadhavsamala3775
    @venumadhavsamala3775 3 роки тому

    Why exactly can't we use Batchable and Future and we stuck to using Queueable?
    Can someone explain?

  • @rajvora5753
    @rajvora5753 3 роки тому

    Are the interview questions related to salesforce object model like shown in the video or could the coding interview questions be related to something from HackerRank or Leetcode google interview questions?

  • @sumitabsaxena349
    @sumitabsaxena349 3 роки тому

    Hey Manish, Can you please suggest what are the limitations in aggregate query that you were discussing?

  • @dheerajpandey2580
    @dheerajpandey2580 4 роки тому +8

    You can create formula field to get days between created date and cure date and then you can use aggregate query :) No need to iterate on trigger new much time you are consuming unnecessary space Awesome video (y)

    • @MariappanPerumal
      @MariappanPerumal 4 роки тому +2

      This way is much better than what they are doing.

    • @hamarecutefunnykids2418
      @hamarecutefunnykids2418 4 роки тому

      Exactly, I was also thinking the same way. Not sure why Ranjan did not go that way.

    • @SFDCFacts
      @SFDCFacts  4 роки тому +6

      Just to reply everyone on this thread, this was a coding interview and follows similar pattern of how product companies take interviews. The objective of these interview is to check your coding abilities and your knowledge of data structures and algorithms, hence you are not allowed to make config level changes.
      But that’s not all, we have discussed this approach as well in the end of part 2 video of this interview.
      Happy learning!!

  • @purvasharma5621
    @purvasharma5621 3 роки тому

    34:00 are we allowed to use formula fields on aggregate queries?

  • @arpitasam9216
    @arpitasam9216 3 роки тому +1

    Thanks for sharing this type of conversation in an interview (mock interview). There are lots of video for salesforce related topics. But hardly we get few like this to get idea about interview process for experienced . Thank you so much.

  • @alok7049
    @alok7049 3 роки тому

    I think group by rollup would do the purpose in trigger after update context, writing so much logic is fine but I think using queries capabilities will simplify. above solution works only when it was built in the starting but later if already had so much data/patients in the area...considering the volume...above solution will not work. we have to use either queries capability or async queries/batch- this is also an example of non-real time processing, need not to be real time.

    • @SFDCFacts
      @SFDCFacts  3 роки тому

      No configuration is allowed, specially the rollup summary, that's the whole point of a coding interview (to test your coding abilities)

  • @anirudhbandi8665
    @anirudhbandi8665 4 роки тому +8

    Ranjan directly subtract date..it won't work..we have to use daysbetween() method to calculate days...apart from that 👍

  • @hamarecutefunnykids2418
    @hamarecutefunnykids2418 4 роки тому

    Good Work @SFDCFacts, Please keep posting these kind of videos.

  • @kumar.anupam
    @kumar.anupam 4 роки тому

    Can it be done without trigger?

  • @ManishKumar-th3cw
    @ManishKumar-th3cw 3 роки тому

    Just a quick thought instead of using the Map mapAreaToCuredAverage = new Map(); and Map mapAreaToCount = new Map();
    Why not create a single map
    Map mapAreaToCuredAverage = new Map();
    and doing so will help to add the diffStateChange value along with no. of patients associated with a particular area.
    In the end we can get the avg time to cure by simply adding the (values in the list of Integers / size of that list)
    It would save using another map and the other Iterations done!.
    Let me know if I missed anything here.

  • @nikhilmhegde
    @nikhilmhegde 4 роки тому

    I think this can be solved very easily. A trigger on the Patient object to update the cured Days or fatal Days whenever the state change happens. Then on the Area object, we would require four Roll-up summary fields, one for total CuredDays, one for total fatalDays, one for the number of cured patients, and one for the number of fatal patients. Then we can create two formula fields to calculate the average fatality rate and average days to recover. Again for this to work we need a master-detail field for this.
    Like if this solution works.

    • @kd-1-9942
      @kd-1-9942 Рік тому

      He said lookup so that he wants to avoid Summary fields as solution but that should be a question to the interview that why not master detail field.

  • @sumanthsf9819
    @sumanthsf9819 4 роки тому

    Amazing Video format watched many SFDC videos but this is very interactive and thorough.

  • @SarGuP
    @SarGuP 3 роки тому

    formula field on child and roll-up summary on parent would be the best approach.

    • @anuragpalivela2898
      @anuragpalivela2898 3 роки тому

      Formula fields that include date values are forbidden for the roll up summary fields. The optimal solution would be to create formula fields to calculate no of days to cure and no of days to fatality and use aggregate soql query like Manish said: may be something like this
      Fields on patient__c object:
      NoDaysToCure__c, NoOfDaysToFatality__c
      List agr = [select Area__c, avg(NoOfDaysToFatality__c), avg(NoDaysToCure__c) from patient__c group by Area__c ];

  • @rosunilck
    @rosunilck 4 роки тому +1

    Awesome Explanation Bro....

  • @shivanichoudhary2345
    @shivanichoudhary2345 4 роки тому +1

    Good work Manish! 👍🏻👍🏻

  • @chandrasekharmedisetti7507
    @chandrasekharmedisetti7507 4 роки тому

    Calling multiple times would end up with query limit.feature we can't pass other than primary parameters.

  • @shri2113
    @shri2113 4 роки тому +2

    Nice video Manish.. Keep it up.
    One request from my side, if you can make a kind of tutorial video on how to measure complexity of code, it would be really great.

  • @arijitnagchowdhury3740
    @arijitnagchowdhury3740 4 роки тому

    nice explanation but why this can not be managed by Batch.

    • @SFDCFacts
      @SFDCFacts  4 роки тому +1

      We have discussed this at the end of part 2 of this interview.

    • @prashantyadav7981
      @prashantyadav7981 3 роки тому

      @@SFDCFacts - it can be done using the aggregate result for average.

  • @nareshvarma9091
    @nareshvarma9091 4 роки тому +2

    Nice approach .First thought after avg problem ,I was thinking of using sub query but time complexity O(n2) . optimum solutions at end are very nice keep good work going 👌

  • @AshishSharma-mn6uc
    @AshishSharma-mn6uc 4 роки тому +1

    Nice glasses Manish 👍

  • @kumudthakur3540
    @kumudthakur3540 4 роки тому +1

    Nice work.. just a thought as you mentioned about custom field. Instead of lookup will create master detail relationship and roll up the formula field. Secondly, if area having more patients like 20000 it may lead to lookup skew issue I guess.

  • @shivanisoni3031
    @shivanisoni3031 4 роки тому +1

    Amazing content. Kindly make a video explaining how to measure complexity of the code.