Skip to main content

All Questions

12 votes
1 answer
6k views

Google FooBar "Prepare The Bunnies Escape"

I'm currently working through the google FooBar challenge, and I'm on the third level, in which I have to find the distance between the top left and bottom right points on a grid. The grid is filled ...
Isaac-Neil Zanoria's user avatar
2 votes
1 answer
60 views

Minimize array and output the remainder with respect to 1 second time limit

This is my code: ...
Arman Malekzadeh's user avatar
4 votes
1 answer
6k views

Split a given number so that their sum adds to another given number

Task You are given a string S containing only decimal digits ('0' through '9') and a number N. Your task is to insert an arbitrary number (including zero) of plus signs '+' into S in order to ...
Rijul Sharma's user avatar
2 votes
2 answers
7k views

Finding an increasing sequence from a given array in a time-efficient manner in Python

Problem Statement: Given a sequence of integers as an array, we have to determine whether it is possible to obtain a strictly increasing sequence by removing no more than one element from the ...
Sreedhar Danturthi's user avatar
3 votes
2 answers
1k views

Compare two files and save the result into a pickle file

My code should compare two vectors saved as dictionary (two pickle files) and save the result into a pickle file too. This works but very slowly. For one compare result I'm waiting about 7:20 min. ...
Yunus Simsek's user avatar
5 votes
1 answer
320 views

AIO programming challenge - Friendlist - Who has the most friends?

I attempted this sample question from the Australia Infomatics Competition. TL;DR - Each line of input contains two numbers, representing a mutual friendship relationship. The output needs to be the ...
John Hon's user avatar
  • 171
14 votes
4 answers
2k views

Codechef: Prime Number Generator

Peter wants to generate some prime numbers for his cryptosystem. Help him! Your task is to generate all prime numbers between two given numbers! Input The input begins with the number t of test cases ...
Subham Goyal's user avatar
4 votes
1 answer
288 views

High execution time to count overlapping substrings

I was doing this HackerRank problem which basically boils down to counting overlapping substrings in a string. I used this solution from StackOverflow to build this program - ...
Sidharth Samant's user avatar
2 votes
2 answers
119 views

Reading a file representing word frequencies in Wikipedia, for clustering analysis

I am writing a system that will run Kmeans to determine the most used words in Wikipedia. I do this by building a core set with streaming data. Wikipedia is 50TB but after a year of processing I was ...
Tony Tannous's user avatar
1 vote
1 answer
6k views

Cropping faces from images in a directory

I am using the below code for cropping faces from images in a directory ...
Pankaj Jain's user avatar
2 votes
1 answer
851 views

Estimating Pi with random darts on dartboard - high complexity issues

I've been trying to write nice snippet of code to simulate pi estimation by randomly throwing darts on a dartboard. While running the following code on high but reasonable numbers my mac doesn't plot. ...
oba2311's user avatar
  • 197
7 votes
2 answers
7k views

Google FooBar XOR Checksum Challenge

Google FooBar came up a few days ago and I took it as a challenge to learn python quickly while having fun. However, I ran into one challenge today that has left me stumped, I've come up with a ...
RoflcopterV RoflcopterV's user avatar
2 votes
0 answers
731 views

Counting numbers in an array that are divisible by any 2 numbers

While solving one question I got stuck with a time limit error. The main objective in question is to count numbers in an array \$A\$ that are either divisible by \$P\$, \$Q\$ or both. Input format: ...
Shashank's user avatar
  • 255
5 votes
1 answer
4k views

Google FooBar Level 3 - Shortest path to 1

I recently found the Google Foobar challenges and am having a problem with level 3. The goal of the task is the find the minimum number of operations needed to transform a group of pellets down into 1,...
Confused in the East's user avatar
2 votes
1 answer
45 views

Determining a value given the coordinates for numbers arranged in a triangular fashion

Numbers are being stacked in the following manner: 7 4 8 2 5 9 1 3 6 10 The x-axis is horizontal and the y-axis is vertical. With that in mind, here are a few ...
Karthic Raghupathi's user avatar

15 30 50 per page