/CTCI

Exercises for Cracking the Coding Interview

Primary LanguagePython

#CTCI ''' Exercises for Cracking the Coding Interview Chapter 1 Arrays and Strings:

  1. Implement an algorithm to determine if a string has all unique characters. What if you cannot use additional data structure?

  2. Implement a function void reverse(char* str) in C or C++ which reverses a null-terminated string

  3. Given two strings, write a method to decide if one is a permutation of the other

  4. Write a method to replace all spaces in a string with '%20'. You may assume that the- string has sufficient space at the end of the string to hold the additional characters, and that you are given the true length of the string. (Note: if implementing in Java, please use a character array so that you can perform this operation in place)

1.4bis) Palindrome Permutation: Given a string, write a function to check if it is a permutation of a palindrome. Example: Tact Coa -> True (e.g. taco cat, atco cta, etc)

1.5) One Away: There are 3 types of edits that can be performed on strings: insert a character, remove a character or replace a character. Given two strings, write a function to check if they are one dit (or zero edits) away. Example: pale, ple -> true pales, pale --> true pale, bake --> False

'''