Questions tagged [puzzle]

DO NOT USE - prefer constructive questions, or use more descriptive tags. Otherwise, your question might be appropriate for codegolf.stackexchange.com.

DO NOT USE - prefer constructive questions, or use more descriptive tags. Otherwise, your question might be appropriate for CodeGolf.


The questions tagged "puzzle" are essentially programming questions, that are as good as solving puzzles. These can be contrasted to the real-life problems, which are comparatively easy to solve.

859 questions
-2
votes
3 answers

How to tackle this puzzle?

Disclaimer: This is not a homework problem. I stumbled upon this puzzle here and I also have the answer. However, I am not able to figure out an approach to arrive at the solution. The puzzle is as given below: The product of the ages of David's…
user2081177
-2
votes
2 answers

Find Number what I selected

I have randomly selected a number between 1 and 1200 in my mind. If you can only ask questions for which I will only reply with “yes” or “no”, how many questions will you need to ask before you arrive at the answer for the number I’ve selected in my…
-3
votes
2 answers

Get all Subsets of String through Dynamic Programming - Programming Contest,Interview

I have a string lets say 123 I need Output as 1,2,3,12,23,13,123 . I know this can be achieved using Dynamic programming . So I need help. The Length of the input string is in the range 10 ^ 6 . Variation of this question : My next problem is I…
Zer0
  • 2,171
  • 3
  • 17
  • 18
-3
votes
1 answer

Skyscraper puzzle with constraint module in python

I have an assignment where I'm supposed to solve a skyscraper puzzle, this specific problem. It is a puzzle made in a grid 4x4 in which every field of the grid has a different value in rows and columns (sudoku like). The values inside the fields…
-3
votes
1 answer

reading crossword puzzle txt file

I am new at JAVA and i got no idea how to start this. I was looking for a good start. I need to read a txt file that has a certain format and put it into a view. i first need to read the dimensions of the grid, then the words in the order of the…
Son Goku
  • 19
  • 1
  • 5
-3
votes
2 answers

Java sum puzzle, stuck with out of bounds error that I can't find

In trying to find to work out a programming puzzle in java, I'm getting some errors that I don't understand even though I've tried editing the code / narrowing the code down to try figure it out. My entire program is below and can be run as soon as…
darkphoton
  • 85
  • 7
-3
votes
5 answers

Student Locker puzzle

/* There are 100 students and 100 lockers. Student 1 opens all, student 2 closes every second one, student 3 changes every third locker(closes if open, opens if close), Student 4 changes every forth locker and so on for all 100 students. Which…
troublefish
  • 19
  • 1
  • 4
-3
votes
2 answers

C# Puzzle within a puzzle, can't figure it out

I need help with this puzzle of C#: Its a fill in the blanks game and the answers can be one of the following to the 7 spaces Blanks look like this _ and are highlighted & there are 7 of them The next part of the puzzle is What C# function can i…
Michael
  • 33
  • 8
-3
votes
2 answers

Sudoku Checker in C Issues

I have Sudoku checker assignment for my class and my task is to be able to create a code that will ask how many puzzles the user would like to solve then they'll input all of the numbers themselves. After they input all the numbers, the output would…
Perez
  • 21
  • 1
  • 6
-3
votes
1 answer

find minimum number of adjacent coin moves?

Piles of coins are given (ex. 5 piles : 9,0,5,1,5 ) total 20 coins.. The minimum no. of moves required so that all piles have equal no of coins (4,4,4,4,4) (ans for this is 9 moves) Rules: one coin can be moved to only adjacent piles..i.e. jth pile…
atlas
  • 5
  • 1
-3
votes
1 answer

Puzzle: using only 2 variables find which element is most frequent in an array

You have a stream that can contain n integers. However it can only contain two diverse values but you do not know upfront which ones they are. Ex: (7,7,4,4,7,7,4), (-1, 6, -1, -1, -1), (0,1,0,0,1,0,1). Using only two named variables (the problem is…
Chris Cinelli
  • 4,679
  • 4
  • 28
  • 40
-3
votes
1 answer

Confused how to implement mathematics in C

I want to make a C program which can solve the below given maths problem, but i'm not able to do it. I would highly appreciate if someone who can do it? A farmer has 81 cows numbered 1 to 81. no 1 cow gives 1kg milk ... no 2 gives 2 kg...... no 81…
techno097
  • 9
  • 3
-3
votes
1 answer

List of interesting and useful Algorithms

I am in a quest of understanding majority of important algorithm that SO community has used in read world applciations. I know a ready list can be extracted from wiki page. But, i am interested only those algorithm or problem that community has…
HokageSama
  • 301
  • 1
  • 3
  • 11
-3
votes
4 answers

How many fewer questions can I ask to guess a number?

If I ask a person to select a number between 1 and 1200 in his mind. If I can only ask questions for which he will only reply with YES or NO, how many questions will I need to ask before I arrive at the answer for the number He had selected in my…
user1995408
  • 11
  • 1
  • 2
-4
votes
1 answer

How Can I Expand The Possibilities Generated by Itertools Library?

I built this code to complete a mathematical challenge were I must find a combination that give me the target result. I must replace "?" for "+", "-", "/" or "*" and add "( )" where it needs to give us the answers. 6 ? 6 ? 6 ? 6 = 5 6 ? 6 ? 6 ? 6 =…
Lucas
  • 5
  • 4