7
votes
3answers
107 views

Compare string with wildcard string

I have the following function to compare a string with a wildcard string (containing ? and *), as C# doesn't seem to have a builtin function to do it. ...
1
vote
2answers
57 views

Given suffix array and a pattern, search if given pattern exists

Given a suffix array for a word, check if a pattern (consecutive chars) exists. Example: A suffix array constructed for "ameya" should return true for "ame" but false for "foo" or false ...
3
votes
2answers
108 views

Calculate all possible combinations of an array of arrays or strings

I'm using code adapted from this Stack Overflow question to calculate all possible combinations from an array, which may contains strings. For example: ...
5
votes
2answers
114 views

Check for correct number of elements in exploded string

Let's say I've got this string: $str = '1-2-3'; and I explode this like so: $strSplit = explode('-', $str); what would be ...
7
votes
2answers
129 views

Generate permutations with symbols

Goal: Create a combination of emails based from inputted first name, last name, middle name, and a domain. Add in common separators. Then I'll check which one is correct with the rapportive API. This ...
3
votes
2answers
155 views

How to get the Split value from collection?

I have the following key value pair in an array, and am trying to extract and load them into a collection. The below code is working but it can be optimized using Linq: ...
13
votes
3answers
3k views

Reverse a String in Java

Here is the code for the CString class that I created. ...
4
votes
1answer
95 views

How to make this lingo game more compact?

I made a lingo game using Python: You guess a word, and if its letter(s) is in the same spot as a hidden word's, you add [] around the letter. If it's in the hidden word, but not in the same spot, ...
4
votes
2answers
81 views

Processing array of objects into two strings

I have an array of Item objects that each have a string particular and a numeric amount. I ...
10
votes
2answers
2k views

Word count program in Java

I am trying to write clean code in Java for reading text of any size and printing the word count in ascending order without using Java collection framework. For example, given the following input ...
8
votes
1answer
2k views

A boolean expression parser, written in Java

I was trying to write some of the Haskell list functions into Java, and I realized that one of the key strengths for many of the functions was the ability to pass in a boolean expression. I decided to ...
4
votes
3answers
90 views

Sorting strings in a one dimensional array

What are the better solutions possible? I have a character array with different strings. There is a max size for the strings. In case a string is smaller than max size remaining places are filled ...
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 ...
2
votes
2answers
536 views

Performance: getting first value from comma delimited string

I've got a string that has values that are delimited by comma's, like so: $var = '1,23,45,123,145,200'; I'd like to get just the first value, so what I do is ...
1
vote
1answer
70 views

Simple Nick Namer Review Request

Hi guys this was my first project, I redid it after getting critique on my second project. Can I please get some Critique on this project too? The code is pasted in sections, but it appears exactly ...
1
vote
6answers
698 views

Remove specific consecutive element in array

I'm trying to reduce consecutive elements of array to one, but not for all values like: {3,0,0,0,3,3,3,0,0,0} => {3,0,3,0} but for specific one, in my example ...
1
vote
1answer
113 views
2
votes
1answer
128 views

Too slow two strings comparer

I have 2 strings for example: abcabc and bcabca or aaaabb and ...
1
vote
1answer
1k views

First non-repeated character in a string in c

Write an efficient function to find the first non-repeated character in a string. For example, the first non-repeated character in "total" is 'o' and the first non-repeated character in ...
2
votes
1answer
163 views

Implement numbering scheme like A,B,C… AA,AB,… AAA…, similar to converting a number to radix26

I want to implement numbering scheme like Microsoft Word uses for numbering. first one gets = A,next is B, next is C, .... then AA, then AB,....and so on. as shown below ...
4
votes
2answers
20k views

Reading a line from a text file and splitting its contents

I have this kind of file structure MALE:FooBar:32 FEMALE:BarFoo:23 Where I would want to identify the gender and age of person, ...
3
votes
3answers
247 views

Improving the code to turn a string into an array of numbers?

I have a string of numbers, like "31654918562314", and I want to convert it into an array of integers. The code I've written is: ...
4
votes
3answers
2k views

Split post string into hash

...
2
votes
2answers
300 views

Remove repeated words from a 2D character array

This code removes repeated words from a word array (2D char array). I want to optimize this as much possible for speed. ...
4
votes
3answers
14k views

What's the best method to initialize character array in C and why? [closed]

I have seen C strings initialized to empty string and a null character. char str[10] = ""; or char str[10] = {'\0'} I am just ...