Skip to main content
The 2025 Developer Survey results are in. Explore insights into technology and tools, careers, community and more. View results.

All Questions

Tagged with
Filter by
Sorted by
Tagged with
4 votes
3 answers
181 views

Redouble each occurrence of char recursively, and add n

In following of this question, I would like to have a second review. The exercise is to write a recursive method that takes a String and a ...
Tobias Grothe's user avatar
3 votes
2 answers
1k views

Counting the number of ways to decode a string

I am working on problem where I need to decode a string: A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... '...
user5447339's user avatar
3 votes
2 answers
594 views

Find the longest sub string of a word after concatenation of given words array

An Array of N words is given. Each word consists of small letters ('a'-'z'). Our goal is to concatenate the words in such a way as to obtain a single word with longest possible substring composed of ...
Ora2gaurav's user avatar
1 vote
1 answer
3k views

All subsets of a String in java using recursion

I wrote this code for printing all sets of a String. It also prints the empty subset. Is this the right approach ...
Curious's user avatar
  • 13
1 vote
1 answer
500 views

Reinterpreting a string, treating < as a backspace character

I've come up with a solution to this coding challenge using recursion. In summary, the input is a string where the < symbol represents a backspace (up to 1 ...
Archie Gertsman's user avatar
1 vote
4 answers
3k views

Split a long string using recursive function

I have executed a program which reads long string and divide the string on basis of specified input. Well I am getting the correct output but would try it to be more efficient and readable. Opinions ...
Vaibs's user avatar
  • 155
0 votes
1 answer
634 views

Permutations of string in Java [closed]

This is a program about finding all the permutations of an string. I want to be able to make it faster and more efficient like eliminating the recursion maybe. Please advise. What is intended is to ...
John's user avatar
  • 9
4 votes
1 answer
304 views

String permutations

So I have tried the famous string permutation algorithm. Example for those who are not familiar with the algorithm: ABC -> ...
cmplx96's user avatar
  • 143
4 votes
1 answer
322 views

String permutation iterative improvements?

I have written some code (below) which iterates over each character of a string and adds that character to every index of previous permutations. For example, in case of abc: b is added to every index ...
Stacky's user avatar
  • 141
5 votes
1 answer
6k views

Replacing characters in a Java string using iteration and recursion

I am new to the whole Data Structures thing and I want to get better at writing efficient code. So, I have been practicing some problem sets. The questions is - Replace characters in a string using ...
Melissa Bundy's user avatar
4 votes
3 answers
6k views

Recursively moving every lowercase 'x' in a string to the end

Given a string, compute recursively a new string where all the lowercase 'x' chars have been moved to the end of the string. ...
Santhosh Chaitanya's user avatar
3 votes
1 answer
573 views

Counting occurrences of "hi" in a string, except where followed by "x"

I already solved this one from CodingBat, but I'm unsatisfied with my solution and I feel I could have made it much shorter. Most of the other recursion tasks could be solved by a one line conditional ...
AdHominem's user avatar
  • 728
3 votes
2 answers
3k views

Non-Contiguous Substrings

Problem: A non-contiguous substring of string \$s\$ is a sequence of \$k \geq 0\$ characters in \$s\$, in the order in which they occur in \$s\$. For instance, the set of all non-contiguous ...
francium's user avatar
  • 139
11 votes
2 answers
457 views

You need to diversify your strings

Challenge: Write a program which prints all the permutations of a string in alphabetical order. Specifications: Your program should accept a file as its first argument. The file contains input ...
Legato's user avatar
  • 9,919
4 votes
3 answers
5k views

Reversing strings using recursion

I'm trying to solve exercises where I am required to use recursion. I wrote this: ...
Pulkownik's user avatar
  • 317

15 30 50 per page