Check if a number is a perfect square
Given a positive number, check if it is a perfect square without using any built-in library function. A perfect square is a number that is the square of an integer.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven a positive number, check if it is a perfect square without using any built-in library function. A perfect square is a number that is the square of an integer.
Compute modulus division of a positive number n by another positive number d which is a power of 2 without using division or modulo operator.
This post will discuss a few related problems that can be solved without using multiplication and division operators.
Write an algorithm to generate any one of the given n numbers according to given probabilities.
Given two integers, find their minimum and maximum without using branching.
Given two numbers, calculate the maximum number without using a conditional statement or ternary operator.
Given two integers, swap them in a single line in Java.
Write a C/C++ program without using the main() function. We are allowed to change the entry point of the program from main() to any other function or remove the main() function altogether.
Write an algorithm to get 0 and 1 with equal probability using a function that generates random numbers from 1 to 5 with equal probability.
This post will discuss how to determine whether two integers are equal without using comparison operators (==, !=, <, >, <=, >=) and arithmetic operators (+, -, *, /, %).
This post will implement a ternary-like operator in C without using conditional expressions like ternary operator, if–else expression, or switch-case statements.
Write an algorithm to generate numbers from 1 to 7 with equal probability using a specified function that produces random numbers between 1 and 5.