Tagged Questions
9
votes
3answers
760 views
Checking brackets nesting in a string
I took a training challenge on Codility that checks for the proper nesting of brackets in a string. The brackets to be checked are {,},(,),[,]. I have written the ...
6
votes
3answers
276 views
Coderbyte SimpleSymbols challenge in Javascript
I am working on a CoderByte problem in JavaScript. I have solved the problem below. Although I am trying to figure out if there is an easier way to do it? I am guessing RegEx will come up, although I ...
5
votes
2answers
2k views
Finding the most common character in a string
I have started to try and work out the TopCoder problems. The "StringDup" problem asks us to:
Create a class called StringDup. Given a string made up of ONLY letters and
digits, determine which ...
4
votes
3answers
151 views
Penney Game - mapping macros to strings
The SPOJ problem:
Given a 40 character string representing outcomes of 40 coin tosses,
find the frequency destribution of all the possible outcome triplets.
So, for string like : HHHH....40 Hs ...
4
votes
2answers
127 views
Rotating the string optimization
Below is the code for the problem at Codechef. I have made use of the String method .equals in my solution which is working fine ...
4
votes
3answers
65 views
String self-similarity
It's a string problem I have been making on Hackerrank. It is executing fine on all test cases except the last two. These last two test case are declaring it "Terminated due to time out".
C programs ...
4
votes
2answers
49 views
Efficient use of regular expression and string manipulation
The following is my solution to Java vs C++. I think the way I have used the re library is inefficient, and possible erroneous as I am getting tle.
...
3
votes
1answer
427 views
Decoding binary string message
I am trying to learn some Java on my own, and I am tackling some "programming challenge" problems to practice the little I have learnt so far.
Could anybody constructively critique this beginner's ...
2
votes
3answers
48 views
Speeding up Project Euler 43 - sub-string divisibility
The number, 1406357289, is a 0 to 9 pandigital number because it is
made up of each of the digits 0 to 9 in some order, but it also has a
rather interesting sub-string divisibility property.
...
1
vote
3answers
164 views
Testing distance between characters in a string
Here is another challenge from Coderbyte. I found this one challenging, although not quite as much as the previous two I've posted. Based on the feedback I received on my earlier posts, I structured ...