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:...
The task is to Increment a number without using ++ and + operators.Examples:...
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...
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....
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:...
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)....
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....
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:...
Given an array A[] of size N / 2, the task is to construct the array B[] of size N such that:...
Given three arrays names[], marks[] and updates[] where:...
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....
Given a number N, check if it is positive, negative or zero without using conditional statements.Examples:...