This challenge is intended to be solved by using, creating, or resolving some processing algorithm.

learn more… | top users | synonyms

-1
votes
0answers
48 views

Pick the Numbers from the Sequence such that resulting sum after some operations is maximum? [on hold]

You are given a sequence of numbers a1,a2,a3, upto an. Now you have to do operations on them that is take any two numbers //taking s=0; s=s+(a1*a2) d=(a1*a2)%199 resulting d now can chose any ...
5
votes
3answers
578 views

Make a WaterOverflow

You and a friend are playing a game - who can overflow the most containers? There are n containers numbered 1 to n. Each container has a certain maximum capacity of water, in litres. You take turns ...
-6
votes
2answers
184 views

Challenge: Crack the code [on hold]

I have created a simple encryption algorithm. Your challenge, if you choose to accept it, is to re-produce the algorithm that encodes one string into it's encoded counterpart and then back again by ...
12
votes
7answers
443 views

Find the maximum operation

The challenge is to find the maximum number you can get from a list of integer using basic arithmetic operators (addition, substraction, multiplication, unary negation) Input A list of integers ...
3
votes
2answers
259 views

Put together cut strips of paper to get original message

This question is from a programming challenge (not DARPA) which has ended. A sheet of paper consists of message, which has been shredded into vertical strips. Given the vertical strips and a ...
13
votes
13answers
2k views

Shortest Code to randomly place points and connect them

The Task This is quite a simple coding task, all your program has to do is place a point on a canvas (or your alternative in another coding language) and connect it to all the dots already placed. ...
10
votes
10answers
2k views

Shortest Longest Increasing Subsequence Code

The Challenge is to write the shortest implementation to find the Longest increasing subsequence . Example : Let S be the sequence 1 5 7 1 8 4 3 5 [length of S = 8 ] We have 1 sub-sequence of ...
10
votes
5answers
705 views

Raise to the Power

Challenge Challenge is writing a program that takes a positive numbers a and a nonzero number b and outputs a^b (a raised to the power b). You can only use + - * / abs() as mathematical ...
3
votes
3answers
375 views

Compress and Decompress sentence using vowel based encryption cipher [closed]

The aim is to parse a sentence and compress/encrypt it according to the rules below and then decrypt it using the key: Remove all letters in a word before the first vowel is encountered. Example: ...
2
votes
6answers
317 views

sort and restore a set of bytes in optimal form

Challenge For any given input Y of length >= 1024 bytes: sort in ascending or descending order -- your choice generate output Q, where Q = [sorted data] + [restore information] restore Y using Q as ...
273
votes
56answers
68k views

Tweetable Mathematical Art

Integer math can generate amazing patterns when laid out over a grid. Even the most basic functions can yield stunningly elaborate designs! Your challenge Write 3 Tweetable (meaning 140 characters ...
3
votes
2answers
446 views

Find the closest pair of integers which will be neighbors when sorting an array

An integer V lies strictly between integers U and W if U < V < W or if U > V > W. A non-empty zero-indexed array A consisting of N integers is given. A pair of indices (P, Q), where 0 <= P ...
2
votes
1answer
331 views

Recursive Mathematical Puzzle from a high school contest

The problem appeared on the 2013 SJCNY High School Programming Contest. It was the last question in the set of problems and no team produced a correct answer during the 2.5 hours they had to work on ...
11
votes
3answers
932 views

Syllabify English words - kind of

You're tasked with writing a program that syllabifies words in a string of text, by separating them with a hyphen. That would be a lot of work, so you want to skip some parts, mainly because you don't ...
4
votes
0answers
255 views

Write a FAST word equation solver [duplicate]

This question is similar to Write a word equation solver by David Frank but different in three important ways: (1) David asked for just the first solution found, and I am asking for all the solutions. ...
-4
votes
4answers
186 views

The Golf (re)Sort [closed]

The Golf (re)Sort Everyone is sorting arrays these days, and so do we at our day jobs. But we like to go out golfing. When we do, we sure like to take our time. It is important to have a stress ...
5
votes
2answers
349 views

Courier Ception

Courier Ception The program must accept any string as input and output an pixel image that shows the input string in Courier. All the letters that contain a 'hole' (like abdegopqABDPQR etc) that is ...
12
votes
9answers
1k views

There is water on my window

The scenario I drive along a road with my car and it begins to rain. The raindrops are falling on my window randomly and now i ask myself, where is the biggest connected wet area? The task To make ...
-4
votes
2answers
226 views

Find the unique number [closed]

I have read a question similar to this. I found it interesting, and difficult so I rephrased the question as a code golf. (that question is closed ) Challenge: In 1 million and 1 numbers, all ...
2
votes
0answers
225 views

Generate random 7-carded poker hand for a given hand type

Represent poker cards as numbers from 0 to 51. 0 to 12 - all hearts from 2 to Ace, 13 to 25 all diamonds and so on. Your goal is to write a function for each poker hand type which generates a random ...
3
votes
0answers
204 views

Write the shortest code that bring to a solution of “The old curious knight with a lazy horse” problem [duplicate]

The Story: Once upon a time there was a curious Knight that lived on a never used chessboard in the Realm, an antique store. He spent all his career over there and when it came the moment of the ...
-1
votes
3answers
144 views

Puzzle : Find minimum resource allocation on multiple of 10 or 12 only [closed]

I have two types of notebook . 10 problems could be solved in one page, in the first notebook. 12 problems could be solved in one page, in the second notebook. For given n problems I have to use ...
1
vote
2answers
234 views

Giant Babylonian Matrices

Introduction The Babylonians had a clever method for finding square roots. To find the square root of a number N, you start with a guess, then refine it by repeatedly evaluating a line of computer ...
17
votes
9answers
1k views

Reverse order of words in a string inplace

The Task You are given a mutable string that matches [a-z]+( [a-z]+)*. You must mutate it into the string which contains the same words, but in reverse order, so that "hello there everyone" becomes ...
5
votes
1answer
148 views

Challenge: compress co-occuring columns into cartesian product

This challenge is inspired by a problem I encountered recently out in the real-world, though ultimately I cheated and found a workaround. Challenge The input is a space-separated table of characters ...
5
votes
7answers
703 views

Super speedy totient function

The goal is simple: calculate the totient function for as many numbers as you can in 10 seconds and sum the numbers. You must print your result at the end and you must actually calculate it. No ...
10
votes
8answers
2k views

Filter a large file quickly

The challenge is to filter a large file quickly. Input: Each line has three space separated positive integers. Output: All input lines A B, Tthat satisfy either of the following criterion. ...
19
votes
10answers
4k views

How high can you go? (A coding+algorithms challenge)

Now that everyone has developed their (often amazing) low level coding expertise for How slow is python really? (Or how fast is your language?) and How Slow Is Python Really (Part II)? it is time for ...
14
votes
5answers
1k views

Closest fraction

Task: Your program is given a proper, positive simple fraction in the format <numerator>/<denominator>. For this input, it must find two fractions. A fraction that is less than the ...
-2
votes
2answers
107 views

All possible permuations in lexicographical order [duplicate]

Given a string of English alphabet characters, write the shortest code to print all possible permuations in lexicographical order without using any language based library. def function('bca'): ...
16
votes
7answers
2k views

Predict where the man will go

A man lives in the north-west corner (0, 0) of a town with height h and width w . Everyday he walks from his home to the border (?, w) or (h, ?). In the following example, the man goes to (3, 3) ...
3
votes
0answers
198 views

Hack Sequence : Simplify Hi = 2014*Hi-1 + 69*Hi-2 [closed]

Can someone help me with simplifying this sequence. I write code to loop through entire n, I am getting timeout. Hack sequence of IndiaHacks-2014 if given as below Hi = 2014*Hi-1 + 69*Hi-2 for (i > ...
18
votes
6answers
1k views

Tower of Hanoi Sort

Write a function/subroutine to sort a list of integers, Tower of Hanoi style. You will be given a stack of integers. This is the main stack. You are also given two more helper stacks. These helper ...
23
votes
6answers
969 views

Circles dividing the plane

This problem idea is borrowed from a recent Croatian programming contest but please don't cheat by looking at the solution outlines :) You are given a set of circles in the plane with their centers on ...
25
votes
1answer
862 views

Minesweeper Solver

We already generated Minesweeper fields, but someone really has to sweep those generated mines before PCG blows up! Your task is to write a Minesweeper Solver that is compatible with a slightly ...
7
votes
3answers
252 views

Determine the critical path

In project management there's a method, called the critical path method, that is used for scheduling activities and for determining which activities' timings are crucial (i.e. critical) and for which ...
2
votes
2answers
159 views

Merging text files based on a prefix key

Imagine an ordered file set : file1, file2, ... fileN. Each file is a textual file that is made of lines that have the same format : A concatenation of a fixed-size key (the same among all the file ...
37
votes
1answer
1k views

Minimal keystrokes needed to type a given text

We all know that programmers tend to be lazy. In order to maximize your free time, you decide to write a program that outputs a minimal number of keystrokes for text fed into it. Input: Text that ...
13
votes
2answers
334 views

Crossword Compulsions!

Chris, a cryptic crosswords addict, has a set algorithm for the order in which he solves them. We will use the above image as a guide. Chris always starts off with the first across clue, in this ...
2
votes
0answers
311 views

Find the best path in a “match-3” game

Suppose you want to cheat in a "match-3" game. In this "match-3" game: In each turn you can move a gem along a path. For example, you can move a gem right-right-down, as in A. (The gems are ...
5
votes
6answers
286 views

Generate lists in which every sublist has a unique element

The problem is defined as follows: Create a function that takes an integer and returns a list of integers, with the following properties: Given a positive integer input, n, it produces a list ...
5
votes
10answers
677 views

Write a hash function for Morse Code

Your goal is to write a hash function, that accepts morse code character and returns a hash code that you get to define. You can be sure, passed string will be: One of the Latin characters (A-Z) ...
10
votes
1answer
263 views

Find the best immediate move in a “match-3” game

Your challenge today is to take input like this: fbcfbee ffcabbe debceec bccabbe edcfbcd daeaafc eebcbeb And output the best possible move in a Bejeweled-like game that will match three or more ...
0
votes
0answers
72 views

Last-letter-first-letter sort [duplicate]

Given a list/array of names(String) sort them such that each name is followed by a name which starts with the last character of the previous name. input [ Luis Hector Selena Emmanuel ...
-8
votes
2answers
487 views

Algorithm to find one unique number in one million and 1 numbers [closed]

I have been asked this question in an interview. In 1 million and 1 numbers, all the numbers having the duplicate except only one number. How to find that one number ? I got an idea to use EXOR gate ...
11
votes
19answers
1k views

Sort the distinct elements of a list in descending order by frequency

Write a function which takes a list or array, and returns a list of the distinct elements, sorted in descending order by frequency. Example: Given: ...
5
votes
11answers
533 views

Convert a decimal to a fraction

Write a program that converts a decimal to a mixed, simplified fraction. Sample input: 5.2 Sample output: 5 + (1/5) The code with the shortest length in bytes wins.
4
votes
12answers
2k views

Array Merge without Duplicates

I recently saw this Javascript code on StackOverflow for merging two arrays, and removing duplicates: Array.prototype.unique = function() { var a = this.concat(); for(var i=0; i<a.length; ...
59
votes
15answers
12k views

9 Hole Challenge

The 9 Hole Challenge 9 code golfing challenges of varying difficulty. Penalties for using the same language more than once. The question will be updated with pars, hole champions and trophy ...
4
votes
1answer
275 views

Decompose a range in aligned blocks of size 2^n

Given an arbitrary contiguous range of positive integers, find the decomposition in the minimum number of sub-ranges of size L = 2^n, with the constraint that each range must be aligned, that is the ...