19
votes
6answers
1k views

How can I make this mess of Java for-loops faster?

I'm trying to find all the 3, 4, 5, and 6 letter words given 6 letters. I am finding them by comparing every combination of the 6 letters to an ArrayList of words ...
11
votes
3answers
723 views

Customised Java UTF-16

I have implemented customized encoding mechanism for javaUTF16. Does this implementation support all the characters? ...
13
votes
4answers
647 views

Count number of each char in a String

I know there is a simpler way of doing this, but I just really can't think of it right now. Can you please help me out? ...
13
votes
3answers
3k views

Reverse a String in Java

Here is the code for the CString class that I created. ...
10
votes
2answers
70 views

Poke-a-Dot (Provider)

I need to create variable-length strings of dots/periods/full-stops to add to some text content, in a way that is similar to a formatted table-of-contents: ...
6
votes
3answers
2k views

Approximate String Matching Interview Question

I was working on the challenge Save Humanity from Interviewstreet for a while then gave up, solved a few other challenges, and have come back to it again. The code below generates the correct ...
5
votes
4answers
237 views

Decompressing a string

We are given a string which is compressed and we have to decompress it. (a(bc2)d2)$ "$" indicates end of string. (abcbcd2)$ abcbcdabcbcd (This is the final uncompressed string.) My ...
2
votes
2answers
125 views

Determine if a word can be constructed from list of subsets [closed]

The question is explained well by examples in the comments below. Also I request verifying complexity: O( n * n!), where n is the number of words in the subsets. Review my code for optimizations, ...
-2
votes
2answers
278 views

Compressing a string

The task is to compress a string. eg. "abcbcdabcbcd" Here as you can see some characters are repeated, so it can be compressed. "abcbcdabcbcd" -> "(a(bc2)d2)$" '$' denotes end of string. My code: ...
7
votes
2answers
133 views

Matching program in Java

I am new to Java and wrote one small program. It works fine, but it looks like it doesn't meet OOP concepts. Could someone look and give me advice so that I can fine tune? ...
5
votes
6answers
7k views

Reversing words in a string

I have to reverse the string "He is the one" to "one the is He". I have written some programs in Java but am looking for other best solutions. Suggest any possible ways to minimize the current ...
5
votes
3answers
2k views

Number aware string sorting with comparator Java

I have this class for use in sorting strings such that if strings have a number in the same position it will order the numbers in increasing order. Alphabetical gives: file1 file10 file2 What I'm ...
3
votes
2answers
115 views

Determine if a word can be constructed from list of subsets - follow-up

I have reworked my code as suggested from my previous question: Determine if a word can be constructed from list of subsets. Please instruct me on the complexity along with a review feedback, as ...
1
vote
3answers
2k views

Calculate all possible combinations of given characters

I was asked in my textbook Lectures on Discrete Mathematics for Computer Science to construct a program that would take an alphabet ({a,b,c} or any combination of ...