Codeforces Round 1133 (Div. 1, Div. 2) is coming soon! Register here. ×

bokuto_alright's blog

By bokuto_alright, history, 2 years 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?
»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it
  • »
    »
    2 years ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    It is. Thank you

    • »
      »
      »
      2 years 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.

      • »
        »
        »
        »
        2 years 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