Skip to content

Trying out some solutions for interview questions

Notifications You must be signed in to change notification settings

fynnwilliam/workout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

652 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

workout

file name description
nth_fibonacci_number.cpp Implemented a function to calculate the nth number in the fibonacci sequence. Calculating largger(>=50) values take a longer time to compute with the standard method. This version uses memoization technique to speed up computation and it works well :).
grid_traveler.cpp The code here return the maximum number of posible ways to travel through a grid of m * n. It is designed with memoization technique so it returns results faster.
can_sum.cpp Confirms wether a target value can be generated using a given array of numbers. We may use any element of the array, as many times as preferred and consider all elements to be positve values. If can_sum(target, v) function were a member function of a class, I would move the lines from the range-based for to the end of the function into a new function to help clean up the implementation. I did not do it here, to prevent forward declearation.
can_sum_r.cpp This is a revised version of what is happening in can_sum.cpp. In this scenario, we may use only one element of the array, as many times as preferred or any pair, once.
how_sum.cpp Displays one of the combination(s) used in generating the target sum as in the can_sum.cpp file.
best_sum.cpp This version of the can_sum function show the first shortest possible combination for generating the target sum.
can_construct.cpp Trying to construct a target string from an array of given words. We can use each word in the array, as many times as needed.
count_construct.cpp Building on can_construct.cpp, we find the maximum number of ways the target string can be constructed.
all_construct.cpp Also progressing on count_construct.cpp, displays all the possible ways of constructing the target string, an empty list otherwise.
missing_number.cpp Finding the missing number in a given integer array of 1 to 100.
insertion_sort.cpp Implements an insertion sort algorithm - elements in the container will be arranged in ascending order.
swap_without_temp.cpp Swapping two numbers or char types without introducing a third variable. Updated function swap_without_temp to support std::strings.

About

Trying out some solutions for interview questions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages