Skip to content

Latest commit

 

History

History
51 lines (27 loc) · 2.46 KB

File metadata and controls

51 lines (27 loc) · 2.46 KB

Cracking the Coding Interview

Vamos focar nos problemas de algoritmos nesse grupo de estudos, e eles são bastante legais porque são voltados pra entrevistas de grandes empresas.

Chapter 1 - Arrays and Strings

Para pesquisar

  • Arrays em Python
  • Strings em Python
  • HashTable
  • StringBuilder

Problemas

1 - Is Unique - is_unique.py

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

2 - Check Permutation - check_permutation.py

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

3 - URLify - urlify.py

Write a method to replace all spaces in a string with '%20'. You may assume that the string has sufficient space at the end to hold the additional characters, and that you are given the "true" length of the string.

4 - Palindrome Permutation - is_permutation_of_a_palindrome.py

Given a string, write a function to check if it is a permutation of a palin­drome. A palindrome is a word or phrase that is the same forwards and backwards. A permutation is a rearrangement of letters. The palindrome does not need to be limited to just dictionary words.

5 - One Away - one_away.py

There are three 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 edit (or zero edits) away

6 - String Comprehension - string_comprehension.py

Implement a method to perform basic string compression using the counts of repeated characters. For example, the string aabcccccaaa would become a2blc5a3. If the "compressed" string would not become smaller than the original string, your method should return the original string. You can assume the string has only uppercase and lowercase letters (a - z).

7 - Rotate Matrix - rotate_matrix.py

Given an image represented by an NxN matrix, where each pixel in the image is 4 bytes, write a method to rotate the image by 90 degrees. Can you do this in place?

8 - Zero Matrix - zero_matrix.py

Write an algorithm such that if an element in an MxN matrix is 0, its entire row and column are set to 0.

9 - String Rotation - string_rotation.py

Assume you have a method isSubstring which checks if one word is a substring of another. Given two strings, sl and s2, write code to check if s2 is a rotation of sl using only one call to isSubstring (e.g., "waterbottle" is a rotation of"erbottlewat")