Skip to content

saradcd77/interview_problems

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

my solution to common interview problems


  1. freq_occuring items -> Finds the maximum occuring character in an array or python list. It only first only one maximum occuring character.

  2. first duplicate -> Finds the number that has duplicate in the list. If there are more than one numbers that are duplicate then it finds the number whose duplicate is index closer to the original number.

  3. sum_of_two_nums -> Given a list of numbers and a number k, return whether any two numbers from the list add up to k.

  4. char_occurence_in_string -> Program to find the number of occurences using dictionary and sorting it to print out in ascending order

  5. sum_of_numbers_in_string -> Finds the sum of numbers in given alphanumeric string

  6. check_balanced_parenthesis -> Checks if the given string has balanced parenthesis (LeetCode Easy Problem)

  7. roman_to_int_conversion -> Converts the string of roman numericals to integer numbers (LeetCode Easy Problem)

  8. merge_to_sorted_list -> Merges two sorted arrays to first sorted array and returns as one sorted array (LeetCode Easy Problem)

  9. plus_one -> Given a non-empty array of digits representing a non-negative integer, plus one to the integer. Digits are stored such that the most significant digit is at the head of the list, and each element in the array contain a single digit (LeetCode Easy Problem)

  10. integer_palindrome -> Given an integer determine if the given integer is palindrome or not. (LeetCode Easy Problem)

  11. reverse_vowels -> Reverses the positon of vowels in a given string

  12. secondlargest.py -> Finds the second largest integer from a given array

  13. isAnagram.py -> Finds if the two given strings are anagram or not (LeetCode Easy Problem)

  14. isIsomorphic.py -> Checks if the two given strings are isomorphic or not (LeetCode Easy Problem)

  15. pairwise_sum.py -> Finds all the pairwise sum from the given array that matches the corresponding given value

  16. string_compression.py -> Returns both the number of times each characters and characters occured in a string

  17. remove_duplicate.py -> Finds the string of url from urls.txt file that occurs most frequently (Asked by Clumio)

  18. remove_duplicate.py -> Returns the list after removing duplicate nums from it (LeetCode Easy Problem)

  19. product.py -> Given an array of integers, return a new array such that each element at index i of the new array is the product of all the numbers in the original array except the one at i. (Asked by Uber)

  20. serialize_binary_tree.py -> Given the root to a binary tree, implement serialize(root), which serializes the tree into a string, and deserialize(s), which deserializes the string back into the tree. (Asked by Google)

  21. non_adj_num.py -> Given a list of integers, write a function that returns the largest sum of non-adjacent numbers. Numbers can be 0 or negative.For example, [2, 4, 6, 8] should return 12, since we pick 4 and 8. [5, 1, 1, 5] should return 10, since we pick 5 and 5. (Asked by Airbnb)

  22. ordered_log.py -> You run an e-commerce website and want to record the last N order ids in a log. Implement a data structure to accomplish this, with the following API: record(order_id): adds the order_id to the log get_last(i): gets the ith last element from the log. i is guaranteed to be smaller than or equal to N. You should be as efficient with time and space as possible. (Asked by Twitter)

  23. char_encoding.py -> Given the mapping a = 1, b = 2, ... z = 26, and an encoded message, count the number of ways it can be decoded. (Asked by Facebook)

  24. sentence_split.py -> Given a dictionary of words and a string made up of those words(no space), return the original sentence in a list. If there is more than one possible reconstruction, return any of them. If there is no possible reconstruction, then return null.

  25. unival_trees.py -> Given the root to a binary tree, count the number of unival subtrees. A unival tree (which stands for "universal value") is a tree where all nodes under it have the same value.(Asked by Google)

  26. find_fixed_point -> Given a sorted array of distinct elements, return a fixed point, if one exists. Otherwise, return False. A fixed point in an array is an element whose value is equal to its index.

About

common interview problems solution

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages