A few programming answers to C++ interview questions
Hello! In this respository, I am sharing my solutions to a few C++ questions that have been used in coding interviews.
// QUESTIONS
-
You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. Write a C++ recursive function to determine how many distinct ways you can climb to the top.
-
Binary Search: Write a C++ function to find the first index of this number in O(log n) time complexity using recursion.
-
Write a C++ function to recover a rotated array to the original sorted array.
-
Given an array nums of integers and an int k, partition the array (i.e. move the elements in “nums”) such that: • All elements < k are moved to the left • All elements >= k are moved to the right Return the partitioning index, i.e. the first index i where nums[i] >= k.
-
Given an unsorted array with integers, find the median of it using the Quick Select method.