Assign other value to a variable from two possible values
Suppose a variable x can have only two possible values a and b, and you wish to assign to x the value other than its current one. Do it efficiently without using any conditional operator.Note: We are not allowed to check current value of x. Examples:...
read more
Increment a number without using ++ or +
The task is to Increment a number without using ++ and + operators.Examples:...
read more
Largest in array without using conditionals / bitwise / ternary operators
Define a function int max(int a[], int n) which returns the largest integer from an integer array consisting of n elements (without using conditionals / bitwise / ternary operators / library function to find largest...
read more
Program to make Indian Flag in Python | Step by Step
Here, We’ll be making Indian Flag in Python using Spyder tool which is a part of Anaconda interface. It is the beginner’s practice problem for python programmers....
read more
Distribution of candies according to ages of students
Given two integer arrays ages and packs where ages store the ages of different students and an element of pack stores the number of candies that packet has (complete array represent the number of packets). The candies can be distributed among students such that:...
read more
A Sum Array Puzzle
Given an array arr[] of n integers, construct a Sum Array sum[] (of same size) such that sum[i] is equal to the sum of all the elements of arr[] except arr[i]. Solve it without subtraction operator and in O(n)....
read more
Solve the Crossword Puzzle
A 10 x 10 Crossword grid is provided, along with a set of words (or names of places) which need to be filled into the grid. The cells in the grid are initially, either + signs or – signs. Cells marked with a ‘+’ have to be left as they are. Cells marked with a ‘-‘ need to be filled up with an appropriate character. You are also given an array of words that need to be filled in Crossword grid....
read more
Time taken by two persons to meet on a circular track
Given integers L, S1 and S2 where L is the length of a circular track in meters, S1 and S2 are the speeds of two persons in kilometers/hour moving in the same direction on the given track starting from the same starting point. The task is to find the following:...
read more
Find the non decreasing order array from given array
Given an array A[] of size N / 2, the task is to construct the array B[] of size N such that:...
read more
Jump in rank of a student after updating marks
Given three arrays names[], marks[] and updates[] where:...
read more
Count of suffix increment/decrement operations to construct a given array
Given an array of non-negative integers. We need to construct given array from an array of all zeros. We are allowed to do following operation....
read more
Check if a number is positive, negative or zero using bit operators
Given a number N, check if it is positive, negative or zero without using conditional statements.Examples:...
read more