Category Archives: Randomized

Given an integer N. A number guessing game is a simple guessing game where a user is supposed to guess a number between 0 and… Read More
Given two integers N and K, where N represents the total number of cards present when game begins and K denotes the maximum number of… Read More
Given four integers N, R, X, and Y such that it represents a circle of radius R with [X, Y] as coordinates of the center.… Read More
If we keenly observe, randomness can be effectively derived from nature. Despite being explainable by scientific phenomena, the behavior of most matter on earth is… Read More
If the receiver proclaims a large window-size, larger than what the network en-route can manage, then there will always be packet losses. So there will… Read More
Given a number N, the task is to construct a square matrix of N * N where union of elements in some ith row with… Read More
Given a string. The task is to find the maximum number P, such that given string can be partitioned into P contiguous substrings such that… Read More
Given a binary array arr[], the task is to find the length of the longest sub-array of the given array such that if the sub-array… Read More
Given an integer N, the task is to generate N non repeating random numbers. Examples:   Input: N = 5 Output: 1 5 2 4 3 Input:… Read More
Generate a random, unique, alpha-numeric string using PHP. Examples: EA070 aBX32gTf APPROACH 1: Brute Force The first approach is the simplest one to understand and… Read More
Now these days, OTP (one time password) is mandatory in almost each and every service. A developer can generate OTP in many ways but the… Read More
Shuffling a list Collections.shuffle() is used to shuffle lists in java. Class hierarchy: java ↳ util ↳ Collections Syntax: Collections.shuffle(list); Examples: filter_none edit close play_arrow… Read More
Mid-Square hashing is a hashing technique in which unique keys are generated. In this technique, a seed value is taken and it is squared. Then,… Read More
Given a password entered by the user, check its strength and suggest some password if it is not strong.Criteria for strong password is as follows… Read More
Given three matrices A, B and C, find if C is a product of A and B. Examples:  Input : A = 1 1 1 1… Read More