Skip to main content

Questions tagged [decision-problem]

For challenges which involve deciding whether or not the input meets certain criteria, and outputting some data, representing that decision.

Filter by
Sorted by
Tagged with
8 votes
2 answers

Determining the winner of a Chess game

Challenge Being someone who plays far too much chess in his spare time, I thought I'd set a code golf challenge inspired by the game of chess (with a software flavour), for those interested. The ...
Noldorin's user avatar
  • 197
16 votes
40 answers

Undulant numbers [duplicate]

An undulant number is a number where its digits alternate between up and down like the following number: 461902 or 708143, or even 1010101, but not 123, because 2 < 3. Write a program or function ...
leonardo's user avatar
  • 341
6 votes
21 answers

Check if number is a sum of consecutive numbers or not

Write a program that checks if a given positive integer can be represented as sum of two or more consecutive positive integers. Example: 43 can be represented as 21 + 22 10 = 1+2+3+4 but 4 cannot be ...
Aman ZeeK Verma's user avatar
23 votes
28 answers

Find whether a number is happy or not?

A happy number is defined by the following process. Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (...
fR0DDY's user avatar
  • 4,577
22 votes
4 answers

Determine if a polygon is convex

Write a program to determine if the input polygon is convex. The polygon is specified with one line containing N, the number of vertices, then N lines containing the x and y coordinates of each ...
Keith Randall's user avatar
22 votes
49 answers

Detect rotated strings

Read two strings from stdin. Output Yes if one string is a rotated version of the other. Otherwise output ...
gnibbler's user avatar
  • 15.1k
94 votes
163 answers

Determine whether strings are anagrams

Challenge Given two strings, work out if they both have exactly the same characters in them. Example Input word, wrdo This returns true because they are the ...
Tom Gullen's user avatar
  • 1,249
8 votes
8 answers

Is this figure connected?

You are given a list of (x,y) grid coordinates. Your function should decide whether the figure obtained by coloring in the squares of the grid with the given ...
Keith Randall's user avatar

12 13 14 15