bokuto_alright's blog

By bokuto_alright, history, 23 months ago, In English

Saw this on LC discussion and have no idea how to approach. https://leetcode.com/discuss/interview-question/5365200/Amazon-OA

  • Vote: I like it
  • +3
  • Vote: I do not like it

| Write comment?
»
23 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it
  • »
    »
    23 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    It is. Thank you

    • »
      »
      »
      23 months ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      It seems logically incorrect to me.

      For example, the answer for "abca" would be 6 {abca, baca, acba, abac, cbaa, aacb}, but the answer from the mentioned solution would be 5, which is incorrect.

      • »
        »
        »
        »
        23 months ago, hide # ^ |
        Rev. 3  
        Vote: I like it 0 Vote: I do not like it

        No, it is correct actually. I coded up the solution and the answer for abca is 6 only Code for reference ->

        My Code