Category: c / c++
Dynamic Programming (DP) is one of the very important algorithm in Computer Science. Here is the simplest example of demonstrating the concept of DP if you want to tell …
Write a method that reverses the given input string. Example: Given s = “12345”, return “54321”. STL The C++ STL provides the reverse method that does the job. class …
Given two integers n and k, return all possible combinations of k numbers out of 1 … n. Example: Input: n = 4, k = 2 Output: , , …
Write a function to find the longest common prefix string amongst an array of strings. For example, should return “a”. The common prefix length should not exceed the minimal …
Given a collection of distinct numbers, return all possible permutations. For example, have the following permutations: , , , , , and . Recursive Permutation Algorithm At position 1, …