instruction
stringlengths
34
53.1k
Your challenge is to divide two numbers using long division. The method we used to use in old days of school to divide two numbers. Example here You should NOT use / or any other division operator in your code. Also, this is not ascii-art Example: Input : 4 2 (4 divided by 2) Output : 2 0 (here 2 is quotient an...
My dog is barking at me, but I'm too lazy to take him for a walk. I have an idea! I'll get the people at Code Golf to do it for me! Your challenge is to simulate a dog's walk. Here are the rules for walking the dog: The human (H) will start at 0,0 on a (Cartesian) coordinate plane, and will randomly go one space eithe...
Suppose we define an infinite matrix M, on N^2 -> {0, 1} (where N starts from 1 instead of 0) in this manner: M(1, 1) = 0. For every x > 1, M(x, 1) = 1 if x is prime, and 0 otherwise. For every y > 1, M(1, y) = the yth term in the Thue-Morse sequence. For every x, y > 1, M(x, y) = M(x, y-1) + M(x-1, y) mod 2. The top...
Inspired by xkcd. Your challenge is to determine whether a number would make a good combination in the game 2048. Your input will be a number, such as: 8224 And the output will be whether that number would make a good 2048 combo, which for this input would be true or yes or 1 or any other way of indicating a positive ...
Write a quine with 1 or more rhyme scheme from http://en.wikipedia.org/wiki/Rhyme_scheme when read. The following characters are spoken aloud: any alphanumeric words or characters not in a comment; comparison and arithmetic characters (+ plus; - minus; * times, / divided by, | or, || or, & and, && and, ! not, = equals...
The code should take text from standard input: The definition of insanity is quoting the same phrase again and again and not expect despair. The output should be a PNG file containing the word cloud corresponding to that text: The above word cloud was created using a specialized online application and it filtered the...
The determined Real Programmer can write Fortran programs in any language. from Real Programmers Don't Use Pascal Your task is to write program in your programming language of choice, but you are allowed to use only another language. That is, throw away all coding conventions from one language and replace them with c...
Input The first line will be a certain string repeated any amount of times. For example, it could be abcabcabcabc, [];[];[];, etc. It may be cut off; for example: 1231231231. Always find the shortest string; for example, if the line is 22222, then the string is 2, not 22 or 22222 or anything else. The string will alway...
The "problem" Define a function log (or other 3 letter name) which when called will log/print/write (whatever is the default for the language in question) both the instruction (as source) and the first argument. In other words: i=777 j=333 log(i) //outputs: "log(i) 777" log(i+j+1) //outputs: "log(i+j+1) 1111" For all ...
There seems to be this ongoing craze about people tediously learning new keyboard layouts like Dvorak or Neo because it supposedly makes them more productive. I argue that switching keyboard layouts is a bad idea, because it can take you months to get up to speed, and when you're finially 5% faster than the rest, you'r...
As we all know, limericks are short, five-line, occasionally-lewd poems with an AABBA rhyming scheme and an anapestic meter (whatever that is): Writing a Limerick's absurd Line one and line five rhyme in word And just as you've reckoned They rhyme with the second The fourth line must rhyme with the third You...
Create a program which gets an input from the user and tells the user what repetitions exist in the it. A few examples of inputs the user could give and outputs they should get: Input: 112211221122 Output: 1122 * 3 Or: Input: 123123 Output: 123 * 2 Or: Input: 1234 Output: No repetitions found! Tiebreaker: if your...
Here are the letters of the English alphabet in order by frequency: e t a o i n s h r d l c u m w f g y p b v k j x q z That is, e is the most frequently used letter, and z is the least common. (Data from Wikipedia.) Your challenge is to take some ROT-n'd text, such as: ocdndnvqzmtnzxmzohznnvbzocvodnqzmtnzxpmzviynvaz ...
In this task, you are allowed make an useful program to do anything you can write within 100 characters. You are allowed to use less characters, but not more. Rules, just to protect from standard loopholes that are no longer funny: Your program cannot access the internet, unless it really has to. For example, the prog...
The zombie apocalypse has come, and the world is coming to an end. Suddenly, someone discovers a formula that takes the current hour, minute, and day, and spits out the perfect note to play on a piano that instantly kills every zombie that hears it. Unfortunately, there is only one piano player left in the world, and h...
Input The symbol of any triadic chord (see http://en.wikipedia.org/wiki/Chord_(music)#Triads). Output The notes constituting the given chord. Examples Input: AM Output: A C# E Input: C#m Output: C# E G# Input: Db+ Output: C# F A Input: C0 Output: C D# F# Bonuses -50 if you can also deal with seventh chords -150 for act...
This is not a Sudoku solver, nor a Sudoku checker. Your challenge is to write a function or script that, given as input the "block" size of a 2D Sudoku puzzle (which is 3 for the classic 9x9 board, 4 for a 16x16 board, etc.) will compute an approximation of the number of distinct puzzles (solutions) that exist for that...
A boolean circuit in TCS is basically a DAG consisting of And, Or, Not gates, and by what is known is "functional completeness" they can compute all possible functions. eg this is the basic principle in an ALU. Challenge: create a circuit to determine whether an 8-binary-digit number is divisible by 3 and somehow vis...
Write a program that is capable of randomly generating itself. It must do this based on the tokens used in its source code. If your program's source code is composed of 50 unique tokens and is 60 tokens long, then the program should output 60 tokens where each token is randomly chosen from one of the 50 unique tokens. ...
It is wartime, and rationing is taking place in certain regions of your country. Your cities' region is one such region. The city chooses to give everyone the same amount, but in reality, larger people need more food. Chances are, a 200lb man is going to be eating more than that 7lb baby over there. The city, realizing...
Write a program that generates a winning sequence of moves to the deterministic variant of the game 2048. The sequence should be in the form of a string of numbers 0-3, with 0: up, 1: right, 2: down, 3: left. For example, the string "1132" means right right left down. The winning program is the shortest source code tha...
Aristotle's number puzzle is the challenge of populating each of 19 cells in a hexagonal grid with a unique integer between 1 and 19 such that the total along every axis is 38. You can picture the game board looking like this: And the puzzle, in essence, is the solution to the following set of fifteen equations: ((a +...
Write a program which takes a 3x3 matrix on stdin and prints its transpose along the anti-diagonal to stdout. You may assume that all elements of the matrix will be integers. Columns are space-separated and rows are newline-separated. Example Input: 1 2 3 3 4 5 1 2 3 Output: 3 5 3 2 4 2 1 3 1 Input: 1 2 3 4 5 6 7 8 9...
Your task is to format an address given in all lowercase to a friendlier format. Here's the catch, no regexes. Addresses will be given in the following format: 123 serpentine pl ne shoreline wa 98199 The expected output is the following: (notice the period and commas) 123 Serpentine Pl. NE, Shoreline WA, 98199 Formatt...
The Kolmogorov complexity of a string s is defined as the length of the shortest program P that outputs s. If the length of P is shorter than the length of s, then s is said to be compressible, otherwise s is incompressible. Most strings are incompressible ... Write the shortest program that outputs this string (withou...
Fillomino is a puzzle where you fill a grid with polyominoes. Each polyomino is an area of contiguous cells. The grid representation shows what size polyomino is covering each cell. For example, a pentomino(5) would be shown as 5 in each of five contiguous cells (see below). Two polyominoes of the same size cannot shar...
Task You will be given a set of circles in the plane with their centers on the line y=0. It is guaranteed that no pair of circles has more than one common point. Your task is to determine into how many regions into which the circles divide the plane. A region is an inclusion-maximal contiguous set of points not interse...
Pretty soon it's going to be 50 years since IBM unveiled its System/360 family of computers. These were the first to use the EBCDIC character set. To mark the occasion, let's see who can write the shortest program capable of converting "ordinary" text to and from EBCDIC code page 037. We'll be using a translation table...
The leaders of the world have met and have finally admitted that the best (and only) way of resolving global economic woes is to take stock of how much they owe each other and just pay each other off with huge cheques. They have hired you (ironically, at the lowest contract rate possible) to work out the best means of ...
You must write functions for addition, subtraction, multiplication, and division; however, you can never use any of your language's number types / primitives -- this means no ints, no floats, no Integers; no nothing. You cannot reference these types at all; not even implicitly, e.g. no pushing and popping numbers on a ...
A 2-way universal logic processor (2ULP) is a network of logic gates that takes two input wires A and B, as well as four other inputs L_, L_a, L_b, and L_ab, and produces a single output L(a, b) using the four L inputs as a truth table function: The 2ULP returns L_ if A and B are both 0. It returns L_a if A = 1 and B ...
Smallest code to return sum of all characters of an array of C-strings, including null-byte-terminattor of each string in the array. example in C: const char *a[] = { "abc", "bdef", "cee", "deee" }; size_t n = sumOfAllBytes(a); printf("n = %d\n", n); // n = 18 e.g., strlen(a[0]) + 1 + ... + strlen(a[n])...
Inspired by the ill-fated sorting-a-numbers-digits-without-using-an-array, but I thought it made a better code golf than SO question. Given a positive integer, sort the digits in that integer. Lowest score wins! Start with 0 points. Add one point per character. Add 20 points for each array you use. Add 10 points for e...
Scenario: while programming you have a sudden nostalgic urge for the '80s and cheesy games. Requirements: Make a GUI program (text probably won't work) for Simon, the game. Input can be clicking, or pressing a key. You should divide the screen into 4 regions: yellow, blue, red, green. When the game starts, a random col...
Jack and Jane decided to play a game of chess to while away time. Unfortunately, Jack is rather bad at visualizing. He finds it tough to figure the moves possible for a given piece other than a pawn, of course! Your challenge is to help find Jack the possible options for a given piece (other than a pawn). In case one...
...so this is a challenge to make me a tree. Produce a program or function called tree which takes a single integer argument, N and draws a Pythagorean Tree N levels deep, where level 0 is just the trunk. Each junction of the tree should place the vertex of the triangle at a random point on the perimeter (this point sh...
You have to write a program that will count all the characters in specified source file so that people entering a code golf competition can see their score. You do not need to ignore comments (it is code golf) in your program but newlines should be counted as a character. The number of characters must be printed to std...
Background: I often find that, when browsing a Stackexchange site, I begin to wonder how people get the amount of reputation that they have. I know I can always count on codegolf SE to solve my problems, so here it is: Create a program that will accept a positive integer which represents a person's reputation. We will ...
Challenge: Given two five-card hands, determine which one wins by the standard ranking of poker hands. Input: Ten cards separated by spaces from stdin or as command line arguments, whichever you prefer. The first five cards are Player 1's hand while the last five are Player 2's hand. Each card will be a two letter stri...
Doorknobs are great and all, but when you open a door, it always dents the walls around it. I need you to take input of ASCII art of a room, like this: +---------+--X --X --+-----+ | \ \ |\ | \ | | \ \ | \ | \| | X | \ | X | / | | \ X | ...
Intro You are sitting in a board room at the end of a long table. You look around and see Tim Cook, the Apple Board of Directors, the ghost of Steve Jobs, and Jack Donaghy. Apple has called this meeting because they have realized how much cooler the Android lock screen is, and they want to 1-UP them. Everyone in the ro...
Task: You are an amazing programmer and Stackoverflow-answerer, and you decide to answer every question with a bounty on Stackoverflow. You are so good, that you manage to get all the bounties in all the questions. While you wait for the rep to come flooding in, you write a program that goes and find out what the total...
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 stacks have a unique property though: every element must be smaller than or the same size as the element underneath it. Th...
Your task is to generate a valid juggling pattern by completing a given template. But first, you probably need to know how such a pattern is denoted. Introduction to Siteswap Siteswap is the established notation for juggling patterns. It works by dividing the pattern into beats. At each beat your left and right hand a...
Your task is to make a program that will take an input of a word of any length, in the Calibri font. This word will be made out of letter characters that are found on a normal QWERTY keyboard. There will be no accents or any other characters (i.e punctuation, numbers etc). So, the original characters are: A B C D E F ...
This is a pretty cool CodeGolf challenge in the sense that you're only going to have a limited amount of time to do it. You need to build a program that "mines" StackOverflow unicoins. In order to do this, you need to perform just two HTTP requests. I'm not going to say how, to add to the fun. The first person to do th...
This challenge has ended! Congratulations Flonk! I was sure I would get a good grade, but after turning in Flonk's my work, my professor did not believe it was mine and also could not understand why it was so complicated... I failed and my mom grounded me from Facebook and Minecraft for a month. I don't understand. :( ...
We have been cloning 2048, analyzing 2048, but why haven't we played it yet? Write a 555 byte javascript snippet to play 2048 automatically, the best score after an hour will count (see scoring below). Setup: Goto 2048 and run: a = new GameManager(4, KeyboardInputManager, HTMLActuator, LocalStorageManager); a is the ...
Beal's Conjecture has a million dollar prize if you prove/disprove it. It states that if where A, B, C, x, y, and z are positive integers with x, y, z > 2, then A, B, and C have a common prime factor. The challenge is to write a program that searches for a counter example to disprove this! Rules Write a program sear...
Edit: There will be a bonus of -20 for random masking Hello fellow Whistleblowers and carriers of secret knowledge. I am due to an interview by mail and I - of course - cannot say specific names in full length. But as I want to disclose it in a rather not-so-obvious-way I need your help. I will provide these names in t...
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 > 2); Hi = 1 for (i <= 2) Given n, you need to find nth term of Hack sequence modulo (109 + 7), i.e Hn % (109 + 7). This is...
Well the community is just a bot. But what if it would have been a person? Your task is to find what community's reputation might have been if it would have been given reputation for the edits it makes.(simply 2*edits) This should work for any site, but we would consider PP&CG for this question. Use any language, even ...
Write a code in your favorite language which reduces words To first three characters. Input : One word Output : First three letters For example INPUT : ProGramming OUTPUT : Pro INPUT : puZZles OUTPUT : puZ INPUT : BoWling OUTPUT : BoW Output needs to be case sensitive Rule-1 All statements should be meaning...
The Situation: Several (M) dwarves have found a goblin's chest with N gold coins and have to divide them. Due to ancient rules governing the allocation of loot to pirates in order of seniority, the oldest dwarf should get one coin more than the next oldest dwarf, and so on, so that the youngest dwarf gets M-1 fewer coi...
Problem Let's say that a word is almost a palindrome if it is possible to remove one of its letters so that the word becomes a palindrome. Your task is to write a program that for a given word determines which letter to remove to get a palindrome. The shortest code to do this in any programming language wins. Input Inp...
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) today. (0, 0) +--+ + + . (0, 4) | + +--+--+ . | + + + + . ...
Greetings, noble code golfers. Today you will resolve the most ancient and distinguished of debates - Emacs or Vim? Your challenge is to take two search terms as input, and output which of those terms has the most Google search results. (This is obviously completely fair. What do you mean, biased?) Here are some exampl...
This is a code-golf, so keep your code small! The objective is to create a function that receives 3 arguments: Rows(int): The max number of an item in each array; Cols(int): The max number of dimensions (sub-arrays); Val(*): The starting value in each item; This function should return a multidimensional array with...
Your challenge is to create a shortest code in your language of choice which writes on a .txt file the longest code to multiply two numbers by taking two numbers as input and output the answer. NO INPUT NEEDED TO YOUR CODE WHICH IS DOING THE WRITING JOB! The generator code and generated code can be in any languages Do ...
The Board The Board is a two dimensional array of cells. Cells are populated by Animals. Every day, all Animals on the Board simultaneously make one move. If two or more Animals move to the same cell, they fight until one remains. The possible moves and attacks are as follows: Moves - { Move.UP, Move.RIGHT, Move.DOWN,...
The Problem I have a bunch of regular expressions that I need to use in some code, but I'm using a programming language that doesn't support regex! Luckily, I know that the test string will have a maximum length and will be composed of printable ASCII only. The Challenge You must input a regex and a number n, and outpu...
I want to play Dungeons and Dragons, but I don't have any dice! Your challenge is to roll some D&D dice. The input format specification in Backus-Naur form is: <valid-input> ::= <opt-integer> "d" <integer> <opt-modifier> <opt-integer> ::= | <integer> <opt-modifier> ::= | "+" <integer> <integer> ::= "0" | "1" | "...
You are a secret agent trying to communicate with your fatherland. Of course the information needs to be hidden so no one eaves drops your message. What would be better suited than a cat? Everyone loves funny pictures of cats [citation needed], so they won't suspect secret information hiding in there! Inspired by the ...
Write a program which determines if a given number is prime. The catch: No digits or arithmetical operators. This means: No digits from 0 to 9, anywhere in the program, and whatever the meaning No using any built-in operators for addition (and incrementing), subtraction (and decrementing), multiplication, division, ex...
Merge Sort In this challenge, you will implement the merge subroutine of merge sort. Specifically, you must create a function or program or verb or similar which takes two lists, each sorted in increasing order, and combines them into one list sorted in increasing order. Requirements: - Your algorithm must take an asy...
I'm looking for the shortest code to generate the following sequences: Sequence A i | y x 0 | 0 0 1 | 0 1 2 | 1 0 3 | 1 1 The best I have is x = i % 2, y = i / 2, there is probably no beating that. Those are coordinates of corners of a box in 2D, but they are not in a good order for drawing. To draw a box as line loop...
A bit-counting comparator (BCC) is a logic circuit that takes some number of counting inputs A1, A2, A3, ..., An as well as inputs B1, B2, B4, B8, ... representing a number. It then returns 1 if the total number of A inputs that are on is greater than the number represented in binary by the B inputs (e.g. B1, B2, and B...
List the coordinates of 8 squares adjacent to (0, 0) in a 2d grid. Namely, [(1,-1),(1,0),(1,1),(0,1),(-1,1),(-1,0),(-1,-1),(0,-1)] Order does not matter. The goal is to store the points into a list. Shortest answer wins.
You are required to write a Hangman solver. Testing against this English word list[1], the solver that solves the most number of words wins, with the number of total incorrect guesses being the tie-breaker. All words in the word list will be tested in random order. [1]: This word list is taken from here, then the numbe...
Without using strings (except when necessary, such as with input or output) calculate the nth digit, from the left, of an integer (in base 10). Input will be given in this format: 726433 5 Output should be: 3 as that is the fifth digit of "726433". Input will not contain leading zeros, e.g. "00223". Test cases / furt...
As we learned from the IBM PC AT, YouTube (see video), Wikipedia (see article), and Sesame Street: The letter H is the most merciless letter of the alphabet! (Even when actually composed from two elements in Code Page 437. In fact, it's even MORE merciless that way.) Like the Aliens in, uhm...er... Aliens, Beasts rele...
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'): return all_permutation. This should return : abc, acb, bac, bca, cab, cba
There is a table (the matrix one, not the one in your kitchen) called the "mex table". It has a left-top cell, at coordinates (0,0), but extends to infinity rightwards and downwards. The x-coordinate increases to the right and the y-coordinate increases downwards. Every cell has a value >=0, and the cell at (0,0) has t...
Count the number of unique fractions with numerators and denominators from 1 to 100, and print the counted number. Example: 2/3 = 4/6 = ... Rules: You must actually count in some way. Only integers are allowed, no floating point numbers or fraction types. Integers count as fractions. So 1/1, 2/1, etc is valid.
The other day we were writing sentences with my daughter with a fridge magnet letter. While we were able to make some(I love cat), we didn't have enough letters to make the others (I love you too) due to an insufficient amount of letters o (4) I then found out that while one set included 3 e letters it had only 2 o let...
From Wikipedia Set-theoretic definition of natural numbers The set N of natural numbers is defined as the smallest set containing 0 and closed under the successor function S defined by S(n) = n ∪ {n}. The first few numbers defined this way are 0 = {}, 1 = {0} = {{}}, 2 = {0,1} = {{},{{}}}, 3 = {0,1,2} = {{},{{}},{{}...
In as few bytes as possible, your job is to write a program that outputs: 3.14 In celebration of a late Pi day of course! :) Rules You can do it anyway you like, but there are some restrictions. You may not use arithmetic operations anywhere in your program. This includes +, -, *, /, %, ^ (exponentiation), etc... Thi...
Your challenge is to write a program which creates ASCII art from an input string, like FIGlet or the Unix banner utility. Specifically, your program should take as input a string consisting of printable ASCII characters, and output an ASCII art representation of those characters in the order they appear in the input. ...
My obsession with set theory continues. I believe that most programming languages have neither sets as possible structures nor set theory operations such as Union and Intersection. If I am wrong then this question becomes trivial and I learn something new. It would be fun to ask for the code golf construction of a ful...
In the fewest bytes, generate the dictionary of keypresses for any letter (as described in https://code.google.com/codejam/contest/351101/dashboard#s=p2) In Python, the dictionary literal itself: {'a':2,'c':222,'b':22,'e':33,'d':3,'g':4,'f':333,'i':444,'h':44,'k':55,'j':5,'m':6,'l':555,'o':666,'n':66,'q':77,'p':7,'s':7...
Speed Clue Cluedo/Clue is a classic board game with a compelling deduction gameplay component. Speed Clue is a 3-6 player variant that emphasizes this component by using only the cards. The result is that the only difference between standard Cluedo and Speed Clue is that each player still in the game may make any sug...
From Wikipedia: PESEL is the national identification number used in Poland since 1979. It always has 11 digits, identifies just one person and cannot be changed to another one. It has the form of YYMMDDZZZXQ, where YYMMDD is the date of birth (with century encoded in month field), ZZZ is the personal identi...
You are to create a program, that, given another program, and a position, will make it a quine. Namely, it needs to insert an expression at that point that evaluates to a string that is the programs input. For example: main=do putStrLn "Welcome to the open source program, would you like my source code?" (ans:_)...
Given is a board of variable size with a maximum size of 5 times 5 fields. Every field kann be filled with an 'x'. If it is not filled with an 'x', it is filled with an 'o'. The starting state of every board is given (see below). With each board, 10 rounds have to be played (at max, conditions: see below) and the evolu...
Your task is to find the total destination of objects that are falling to a planet, you will get inputs like this: 7 ...#... ....... #..O..# ....... ...#... ....... ....... where O is the planet and # are the objects, note that the planet will attract objects from the for basic directions(NEWS). You should ou...
Hunger Gaming - Eat or Die If you don't eat, you die. If you eat, you live (until you die). You will die, so try to die last. Overview There is an island populated with a herd of prey animals. You control a pack of five predators. Your object is to keep your pack alive. Do this by eating prey. The prey tend to run from...
The largest forum on the web, called postcount++ decided to make a new forum game. In this game, the goal is to post the word, but the word has to have one letter added, removed, or changed. Your boss wanted you to write a program which gets the word, and the UNIX dictionary, as you work for company who has more intell...
The goal is to take CSS rules from a regular CSS file and apply them to their respective targets in an HTML file, but by placing the rules in the style="" attribute (using the <style> tag would be too simple) and removing the class="" and id="" attributes. Rules: Only ids #id and classes .class selectors must be suppo...
The parentheses on my keyboard are all worn out, and I want to avoid using them as much as possible. Your challenge is to balance a line containing parentheses by adding them in before and after each line. This is similar to TI-Basic's automatic parentheses and string closure (i.e. Output(1, 1, "Hello, World!). It also...
The goal of this code golf is to draw a regular polygon (one with equal side lengths) given the number of sides and radius (distance from center to vertex). The number of sides and the radius can be entered via a file, STDIN, or just a plain old variable. Use whatever is shorter in your language. -25% of total charac...
I challenge you to generate the following sequence till 100 terms through any programming language in shortest characters possible. The sequence is like this :- 1 2 3 4 5 10 20 30 40 50 100 200 300 400 500 ........ The output needs to be like this (above) only, nothing extra. Remember, You can use + and - only and...
Inspired by this question on SO, your task is to produce a program that is valid in (at least) two major versions of your chosen language that produce different output. Rules Any language that has more than one major version can be used. For the purposes of this challenge, I would suggest a "major version" is where ...
I know there is an (old) thread similar to this (here), but I'd like to reboot it with some modifications. The goal: generate a random-looking maze using an algorithm of your choice, then output the maze graphically (printing counts). The width and height are determined by you. There should be at least one path from a...
Task: Remove all duplicates from one list of integers. A list is simply a sequence of connected values that allows the same values to be stored at different positions in this sequence. If an item was found to be the same value as another item in this list, keep the first occurence of the item and remove the second (thi...
The challenge is to, given a list of points, sort in a way that, when they are connected in this order, they never intersect. Input format (read from stdin): X Y 1 2 3 4 5 6 ... Output should be the same as input, but sorted. Rules: You can start from any point. The last point must be same as first one, making a clos...
You are given a directed graph in an adjacency dictionary format. This can be whatever format is most natural for your language. For instance, in python, this would be a dictionary with keys of nodes and values which are lists of nodes which that node has an edge to. For instance: G={1: [2, 3], 2: [3], 3: [1], 4:[2]} ...
As I'm sure many of you know, synonyms can range from very similar to not-so-similar-but-I-can-see-how-it's-similar. It's common for dictionaries to use "See also" to denote occurrences of words that have especially good synonyms. Thesauruses (Thesauri?), on the other hand, list every word that is remotely close in def...
Input: 1 X X X X XX XXXXXX X X X X XX XXXXXX X X X XXX X XX XXXXXX X X X XXX X XX XXXXXX X X X Output: X. ...
Given a string where the first line contains spaces and one period (., the "ball"), followed by lines containing spaces, forward slashes (/), and backslashes (\), determine what column the ball will land in after falling from its starting position. Each / moves it to the left by 1 column and each \ moves it to the righ...
Example given an image which width and height is a power of two . First step : Divide each image into Cartesian coordinate quadrants _____ _____ | | | | 2 | 1 | |_____|_____| | | | | 4 | 3 | |_____|_____| Second step : Divide each quadrant to another four quadrants and add new quadrant id a...