It is a google interview question and I find most answers online using HashMap or similar data structure. I am trying to find a solution using Trie if possible. Anybody could gi
I tried to code this problem in C++ ..where i created my own hash key and go through all the combination with the given characters.
Going through all the combination from these input characters from the largest length to 1
Here is my solution
#include "iostream"
#include
using namespace std;
int hash_f(string s){
int key=0;
for(unsigned int i=0;i0;i--)
{
if( ((i==n-1)&&indexes[i] m)
break;
for(int i=1;i0;i--){
r = combination_m_n(str, str.size(),i ,num);
for(int i=0;i