CTCI list

VV
2 min readJun 30, 2021

Here is the leetcode list for CTCI questions

Some questions are not present in the list so I have included them here

Leetcode list 👈

Remaining questions

Check if a string has all unique characters without using any additional data structure (here)

URLify a given string replacing all the spaces in a string with ‘%20

Here we do only need to replace the spaces in between words not the trailing spaces add (2*no_of_spaces) more as 1 space will already be available “ “ we there we can add “&” and now we add 2 more spaces to have “20” so finally we’ll get “%20”

visit here for github code 👈 or here at gfg 👈

Check if characters of a given string can be rearranged to form a palindrome

github here & gfg here

(factorial time brute -> sorting -> hashing)

1 Edit Dist away ( related to Edit dist problem on dp)

3 operations insert/delete/replace allowed …determine whether string 1 can be converted into string 2 using only 1 operation (here)

Brute force is DP edit dist problem…just find edit dist of both strings and if edit dist==1 return true (O(N²) time )

Optimal solution is Just traverse both strings ( 2 pointers) and apply logic and for each operation required do count++, if count!=1 return false

String compression

good blog , see my various solutions here

--

--