Tagged Questions
3
votes
1answer
1k views
Writing to an HttpURLConnection in a loop
I have this method which sends binary data to server. The code works fine, but still, it's structure is kinda stupid: output and input connections are opened like thousands times (depends on data ...
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 ...
9
votes
3answers
282 views
Optimizing “Herd Sums” problem using dynamic programming
I'm trying to solve a practice problem and all is well except for the last 2 inputs my solution is too slow. Just one loop is slowing it down I think.
Herd Sums
Execution Time Limit: 2 ...
5
votes
1answer
106 views
Optimising Funny Marbles
Problem statement is at http://www.codechef.com/DEC13/problems/MARBLEGF
Lira is given array A, which contains elements between 1000 and 2000.
Three types of queries can be performed on this ...
3
votes
2answers
1k views
Differences between using a do-while vs. while and initializing variables
When I use a do-while loop, I can create a variable userInput, but don't need to initialize it until the ...
2
votes
2answers
123 views
A matrix with square diagonals and transpose being increments of other
Construct a matrix with the following property:
North-west to South East diagonals are squares.
Matrix[i][j] + 1 = Matrix[j][i] for each i less than j.
Example of such m a matrix is ...
-1
votes
3answers
397 views
dead code and infinite loops with java for loop [closed]
I have a for loop that loops infinity when i don't breakout of it and only loops once when i do break out of it. I'm sure im missing something simple.
The if and else should be identical aside from ...