1
vote
1answer
69 views

High School Java Class: Pong Project External Reviewer

Panelball class: import java.awt.*; import java.awt.event.KeyEvent; import javax.swing.*; public class Panelball extends JPanel implements Runnable { private static final long ...
2
votes
1answer
109 views

Too slow two strings comparer

I have 2 strings for example: abcabc and bcabca or aaaabb and abaaba I checked that second string is the same or not like first string but shifted. bcabca = ..abca + bc... Here is code it works ...
1
vote
1answer
158 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 "teeter" is ...
2
votes
1answer
64 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 A B C . . AA ...
4
votes
2answers
2k 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, <Gender>:<Name>:<age> try{ BufferedReader in = ...
3
votes
3answers
195 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: string source = "31654918562314"; int[] numbers = new ...
4
votes
3answers
1k views

split post string into hash (ruby)

if(env['REQUEST_METHOD'] == 'POST') $post = {} post = env['rack.input'].read.split('&') post_split = Array.new post.each{|x| post_split << x.split('=')} post_split.each{|x| ...
4
votes
3answers
6k 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 confused which one is the best practice and I would like to know if ...