The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
4answers
84 views

reduce time limit for program

i have to create a program in which t sets of m and n will be given by user. for each set we have to generate all prime numbers between m and n. this code is successfully executed with correct output ...
2
votes
1answer
121 views

Javascript “recursion” via setTimeout

I understand that because of Javascript's single-threaded execution, long loops or recursive calls could make the browser unresponsive while they execute. I thought about simulating recursion using ...
0
votes
2answers
296 views

Optimization in overcoming TLE in interviewStreet problem

I have been trying to get the problem Quadrant Queries correct for a while now. Although my approach is an optimal one, I am getting a TLE on 3 test cases. Please help me optimize my approach so that ...
3
votes
1answer
76 views

Time Limit decorator

I have an interface named ICodeRunner, defined like this: public interface ICodeRunner { ExecutionResult Run(string code); } I have more classes that implement ICodeRunner, but regardless ...
3
votes
1answer
803 views

code to be improved to speed-up execution time

import java.util.ArrayList; import java.util.Scanner; import java.util.TreeSet; public class find_str { private static final String INVALID = "INVALID"; private TreeSet<String> mainset ...
2
votes
2answers
201 views

Java k_diff : can this code be improved to run faster?

import java.util.Scanner; public class k_diff { public int process() { Scanner scanner = new Scanner(System.in); int total_nums = scanner.nextInt(); int diff = ...
3
votes
2answers
497 views

How can I improve performance of this?

import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner scanner; Solution sr = new Solution(); scanner = new Scanner(System.in); ...
5
votes
2answers
478 views

Optimizing string match algorithm

I was trying to solve this problem: https://gist.github.com/1466664 I thought of any possible relation between the number of matches among subsequent substrings, but could not find one. So, the ...
4
votes
1answer
308 views

Is this waiting code with timeout ok?

public boolean connectedOnGameServer = false; public final Object conGameServerMonitor = new Object(); public void connectedToGameServer() { synchronized (conGameServerMonitor) { ...
11
votes
3answers
8k views

Correct use of Monitor.Wait, Monitor.Pulse and timeout

I have the following code that I use to determine if connection has been made to a communications device. I am unsure if my use of Monitor.Wait and Monitor.Pulse is correct. It seems to work alright, ...