Twitter OA Early Career 2022
Anonymous User
1988
  • How many sentences?

    I created a custom hash string for each word as in the form of; [occurence count][character][occurence count][character]... For instance hash string for the word eat would be "1a1e1t" in the lexicographic order. Similarly, hash string for word ate or tea the would be "1a1e1t" as well. Then, I iterated over the given words and counted their occurrences in a HashMap. Last stage was iterating over the sentences and multiplying the values retrieved from the HashMap using the hash string as key.

    Examples to my custom Hash String:
    glass -> 1a1g1l2s
    sassy -> 1a3s1y

  • String Reduction

  • Disk Space Analysis

  • Largest lexicographical string with at most K consecutive elements

Solved all 4, passing each and every test case. Submitted in last 3mins. Watch out for the clock if you are going to take the test. Haven't heard back yet.

Comments (2)