Tutorialspoint.dev
Welcome To Tutorialspoint.dev
Officially launched 18th May 2019
C C-Macro & Preprocessor cpp-macros

A C Programming Language Puzzle

Give a = 12 and b = 36 write a C function/macro that returns 3612 without using arithmetic, strings and predefined functions. We strongly recommend you to minimize y...
C C-Loops & Control Statements C

A nested loop puzzle

Which of the following two code segments is faster? Assume that compiler makes no optimizations. /* FIRST */ for(i=0;i<10;i++)   for(j=0;j&l...
C C++ CPP-Functions

A C/C++ Function Call Puzzle

Consider the following program. Predict the output of it when compiled with C and C++ compilers. void func() {     /* definition */ } ...
Arrays C++ cpp-puzzle

Programming puzzle (Assign value without any control statement)

Given four integers ‘a’, ‘b’, ‘y’ and ‘x’, where ‘x’ can only be either zero or one. Your task i...
Arrays Mathematical Accolite

A Product Array Puzzle

Given an array arr[] of n integers, construct a Product Array prod[] (of same size) such that prod[i] is equal to the product of all the elements of arr[] except arr[...
Mathematical Mathematical

How to check if an instance of 8 puzzle is solvable?

What is 8 puzzle? Given a 3×3 board with 8 tiles (every tile has one number from 1 to 8) and one empty space. The objective is to place the numbers on tiles in o...
Backtracking Backtracking

Solving Cryptarithmetic Puzzles Backtracking-8

Newspapers and magazines often have crypt-arithmetic puzzles of the form: SEND + MORE -------- MONEY -------- The goal here is to assign each letter a digit fr...
Backtracking Backtracking

Magnet Puzzle Backtracking-9

The puzzle game Magnets involves placing a set of domino-shaped magnets (or electrets or other polarized objects) in a subset of slots on a board so as to satisfy a s...
Backtracking C++ Programs Backtracking

C++ program for Solving Cryptarithmetic Puzzles

Newspapers and magazines often have crypt-arithmetic puzzles of the form: Examples: Input : s1 = SEND, s2 = "MORE", s3 = "MONEY" Output : One of t...
Bit Magic Bit Magic

A Boolean Array Puzzle

Input: A array arr[] of two elements having value 0 and 1 Output: Make both elements 0. Specifications: Following are the specifications to follow. 1) It is guarant...

Subscribe to Our Newsletter