All Questions
12 questions
5
votes
2
answers
173
views
LeetCode Number 416: Partition Equal Subset Sum
Problem: MLE
I am confused as to why the LeetCode judge reports Memory Limit Exceeded when my solution looks close to the editorial solution. I not too familiar with ...
8
votes
2
answers
196
views
Leetcode 93: Restore IP Addresses (C version)
This is posted in response to this request made in a discussion of my "C-ish" answer to a recent Code Review question regarding a Python solution to a Leetcode challenge. It was reported ...
4
votes
2
answers
66
views
Optimizing a Function to Generate a Row of Consecutive Odd Numbers in a Triangle
I've written a JavaScript function that generates a row of consecutive odd numbers in a triangle. The triangle looks like this:
...
1
vote
1
answer
1k
views
Follow-up: How can we optimizing Java BigInteger operations?
This is the follow up question of How can we optimizing Java BigInteger operations?
Problem
Reduce the number to 1 in a minimal number of steps, following the rules:
...
4
votes
2
answers
273
views
Minimum number of copies of an application a company needs to purchase
Some applications from vendors are allowed to be installed on multiple computers per user with specific
restrictions. In our scenario, each copy of the application (ID 374) allows the user to install ...
2
votes
1
answer
96
views
Permutation code in C
I am pretty new to competitive programming. It took me almost 3 hours to make this, initially I started with 4 for loops and then to make it scalable for sizes bigger than 4, I decided to turn this ...
6
votes
2
answers
120
views
Program for activity selection exceeds time limit
I've been trying to solve this problem for some while and the solution I have come up with exceeds the lime limit by 1-3 ms and 2 out of 10 tests get a memory issue error. Why is that? This is the ...
2
votes
2
answers
1k
views
Project Euler #15 in Python
I've wrote the code for Project Euler #15 and it runs amazingly fast. I know I can write it using binomials but I wanted to calculate by brute force as if I do not know Binomials. But I think it must ...
3
votes
2
answers
940
views
Find two numbers that add up to a given total, from a formatted string
The full challenge from codeeval.com can be viewed here.
Input
Your program should accept as its first argument a filename. This file
will contain a comma separated list of sorted numbers and ...
3
votes
3
answers
194
views
Storing and processing large arrays to compute dot products
Problem Statement (from HackerRank)
We have two arrays \$a\$ and \$b\$ of length \$N\$, initially all values equals to
zero. We have \$Q\$ operations. Let's define three types of operations on
...
5
votes
1
answer
520
views
CodeEval solutions to find trailing strings
This is a problem in CodeEval, moderate level. The problem is very easy for this level. But I am not able to get more than 60 points for any solution I submit. (Moderate levels highest score is 65 and ...
3
votes
1
answer
221
views
Yellow Pages Search
I've written code in Free Pascal based on a contest problem (The contest insists that I have to write with Pascal). It works like charm, but I think it still need some improvements, from memory usage ...