CS Puzzles

Computer Science has many problems, puzzles, and patterns to solve. Below are some of the most popular Computer Science puzzles and the solution. Many of these puzzles are asked during interviews with software companies. You will also find fun projects on this page!


Projects

Kano Kit

Build your own computer using this kit. It's powered by Raspberry Pi 3 and Kano OS. With this kit you will get the programs and apps that you need to learn to code and unlock your true potential and creativity! This is a perfect gift for kids or anyone who wants to learn about computers and programming.

Buy

Piper Computer Kit

With this kit, you don't just play mindcraft, but you build it. You build your own computer using this kit, and with physical controls, buttons, switches and lights continue to build power-ups within the game.


Buy Kit


Two Sum

Find The Smallest Positive Integer Value

C Program Vowels and Consonants

Find The Missing Number


Puzzles

Eight Queens Problem

The eight queens puzzle is the problem of placing eight chess queens on an 8×8 chessboard so that no two queens attack each other. Thus, a solution requires that no two queens share the same row, column, or diagonal. The eight queens puzzle is an example of the more general n-queens problem of placing n queens on an n×n chessboard.

Solution Java Program

Towers of Hanoi

The Tower of Hanoi is a game or puzzle. It consists of three rods, and a number of disks of different sizes which can slide onto any rod. The puzzle starts with the disks in a neat stack in ascending order of size on one rod, the smallest at the top, thus making a conical shape. The objective of the puzzle is to move the entire stack to another rod, obeying specific rules.


Solution Java Program

Dining Philosopher Problem

Five silent philosophers sit at a table around a bowl of spaghetti. A fork is placed between each pair of adjacent philosophers. Each philosopher must alternately think and eat. However, a philosopher can only eat spaghetti when he has both left and right forks. Each fork can be held by only one philosopher and so a philosopher can use the fork only if it's not being used by another philosopher.

Solution Java Program



Traveling Salesman Problem

The travelling salesman problem (TSP) asks the following question: Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city exactly once and returns to the origin city?





Solution Java Program


Light Bulb Puzzle

Given 20 ‘destructible’ light bulbs (which breaks at a certain height), and a building with 100 floors, how do you determine the height that the light bulb breaks?








Solution

The twelve-coin problem

There are twelve coins, eleven of which are identical and one of which is different, but it is not known whether it is heavier or lighter than the others. The balance or scale may be used three times to isolate the unique coin and determine its weight relative to the others.



Solution

Wheat and chessboard problem

If a chessboard were to have wheat placed upon each square such that one grain were placed on the first square, two on the second, four on the third, and so on (doubling the number of grains on each subsequent square), how many grains of wheat would be on the chessboard at the finish?

Solution

P versus NP problem

The P versus NP problem is a major unsolved problem in computer science. Informally, it asks whether every problem whose solution can be quickly verified by a computer can also be quickly solved by a computer. It is considered by many to be the most important open problem in the field, It is one of the seven Millennium Prize Problems selected by the Clay Mathematics Institute to carry a US$1,000,000 prize for the first correct solution.

Solution

Problem Sets

UCF Problem Sets

UCF Programming Team Problem Sets

In the link above are the problem sets from all of UCF's programming team contests, and the judge solutions and judge data from most of them.


Interview Puzzle: 8 balls and a weighing scale

randerson112358

There are 8 basketballs and 1 scale. 7 of them weigh the same. 1 of them has a different weight, (it's heavier or lighter). How do you find the odd ball with 2 weighs?