This challenge is intended to be solved by using, creating, or resolving some processing algorithm.
-1
votes
0answers
91 views
Tips to follow before solving 5 mins Programming Riddles [closed]
Whenever I go for an interview, they ask me to write a Function in C in paper within 5 to 10 mins, which performs a specific task.
Examples :
Write a C function which returns the minimum ...
-1
votes
1answer
117 views
Filling slot based on limit [closed]
Duplicate of http://stackoverflow.com/questions/15726734/iterating-item-in-a-loop
I have a List<int> with the values like 60,45,45,45,45,30,60,60,15 people
Also i have two slots. 1st slot is ...
-2
votes
1answer
91 views
IPv4 “in subnet” function [closed]
Implement the following JavaScript method as short as possible:
function same_subnet(ip_a,ip_b,sn_mask)
{
}
It should get 2 IP addresses and a subnet mask. It should return true if ip_a and ip_b ...
1
vote
7answers
449 views
recursive power algorithm
Have a look at my (javascript) version of a O(log(n)) xn algorithm:
function pow(x,n)
{
return n==0?1:n==1?x:n==2?x*x:pow(pow(x,(n-n%2)/2),2)*(n%2==0?1:x);
}
Can you get it shorter?
7
votes
1answer
329 views
Generate a number by using a given list of numbers and arithmetic operators
You have a list of numbers L = [17, 5, 9, 17, 59, 14], a dictionary of operators O = {+:7, -:3, *:5, /:1} and a number N = 569.
Task
Output an equation that uses all numbers in L on the left-hand ...
11
votes
3answers
1k views
Solve Rubik's cube
Write the shortest program that solves Rubik's cube (3*3*3) within a reasonable amount of time and moves (say, max. 5 seconds on your machine and less than 1000 moves).
The input is in the format:
...
9
votes
5answers
540 views
Swapping numbers
This is a common puzzle many of you have solved manually. Now this is the time to write an algorithm to solve the same.
There are equal number match sticks lined up in two different side facing each ...
8
votes
8answers
409 views
Make a pattern alternate
Problem
You are given a sequence of coloured balls (red R and green G). One such possible sequence is:
RGGGRRGGRGRRRGGGRGRRRG
In as few moves as possible, you must make it so that each ball is a ...
2
votes
2answers
289 views
Rail fence cipher- Is there any better solution?
I have coded Rail Fence Cipher in Python. I was wondering if there could be a better solution.
For those who don't know what rail fence cipher is, it is basically a method of writing plain text in a ...
8
votes
1answer
291 views
Compact a Befunge program
Befunge is a 2-dimensional esoteric programming language. The basic idea is that (one-character) commands are placed on a 2-dimensional grid. Control flow walks across the grid, executing commands it ...
-1
votes
2answers
370 views
“Defragmenting” a list
A fragmented file is a file which is seperated into several parts on a harddrive, because it can't fit into a certain space.
On all harddrives, there are files called unmovable files, which are ...
3
votes
3answers
401 views
Secret Santa Challenge [duplicate]
Possible Duplicate:
Holiday Gift Exchange
Background:
Secret Santa is a Western Christmas tradition in which members of a group or community are randomly assigned a person to whom they ...
4
votes
4answers
371 views
Fast inverse square root
Inspired by Write a code golf problem in which script languages are at a major disadvantage question on meta, I've decided to make a question which could be problematic for scripting languages.
The ...
2
votes
1answer
230 views
Implement DES key expansion
I wanted to make a challenge to do the full DES encryption algorithm, but that may be a bit too involved to get a ton of participation. This challenge is to simply generate the 16 48-bit subkeys used ...
7
votes
5answers
318 views
Bijection between binary strings and pairs thereof
Input: Either one or two strings of '0's and '1's. If there are 2, they are separated by a space. All strings are of length at least 1.
Output: If one string was input, 2 are output. If 2 were ...