Skip to content

Category Archives: Randomized

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 the union of elements in some ith row… Read More
Given a string. The task is to find the maximum number P, such that a given string can be partitioned into P contiguous substrings such… 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: N… 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:  Java // Java program to demonstrate… 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… 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
Given a function random01Generator() that gives you randomly either 0 or 1, implement a function that utilizes this function and generate numbers between 0 and… Read More
Given a Binary Tree with children Nodes, Return a random Node with an equal Probability of selecting any Node in tree.Consider the given tree with… Read More
In this article, we will discuss how to implement QuickSort using random pivoting. In QuickSort we first partition the array in place such that all… Read More
Given two sparse matrices (Sparse Matrix and its representations | Set 1 (Using Arrays and Linked Lists)), perform operations such as add, multiply or transpose… Read More

Start Your Coding Journey Now!