Skip to main content

All Questions

Filter by
Sorted by
Tagged with
7 votes
5 answers
736 views

String combinations of 0 and 1

I was asked this question in an interview: Given a string s consisting of 0, 1 and ...
user5447339's user avatar
3 votes
3 answers
12k views

Letter combinations of phone dial pad number

In preparation for interviews, I have written a solution to this question: Given a sequence of numbers (34128) and an input map such as a dial pad on a phone (2->[a,b,c], 3->[d,e,f], 4->[g,h,i]) ...
david's user avatar
  • 1,997
1 vote
1 answer
2k views

Print all permutations of a given string in Java

I want to print all permutations of a given string in Java. To do this I create one auxiliary array boolean used[] to check if I have used some character or not. <...
user3371223's user avatar
5 votes
1 answer
20k views

Print all possible combinations of size r, from an array of size n

This is my working solution for the following problem: given an array of integers of size n, print all possible combinations of size r. Before I proceed to the solution, I have the following question:...
user3371223's user avatar