## Search element in a sorted matrix

Given a sorted matrix mat[n][m] and an element ‘x’. Find position of x in the matrix if it is present, else print -1. Matrix is… Read More »

## Amazon Interview Experience | Set 348 (For SDE II)

Recently, I was interviewed by Value Added Services team for SDE II position at Amazon Hyderabad campus. Telephonic Round: 1:15 Hours Given a set of… Read More »

## Find distance from root to given node in a binary tree

Given root of a binary tree and a key x in it, find distance of the given key from root. Dis­tance means num­ber of edges… Read More »

## Longest alternating subsequence

A sequence {x1, x2, .. xn} is alternating sequence if its elements satisfy one of the following relations : x1 < x2 > x3 <… Read More »

## random header in C++ | Set 3 (Distributions)

We have discussed generators in Set 1. We have also discussed three distributions in Set 2. In this post, more distributions are discussed. IV.Rate-based Distributions:… Read More »

## Number of ways to cut a stick of length N into K pieces

Given a stick of size N, find the number of ways in which it can be cut into K pieces such that length of every… Read More »

## ftell() in C with example

ftell() in C is used to find out the position of file pointer in the file with respect to starting of the file. Syntax of… Read More »

## Microsoft Interview experience | Set 115 (4 Years Experienced for IDC)

1st Round : 1)https://www.geeksforgeeks.org/maximum-product-subarray/ 2)https://www.geeksforgeeks.org/sort-an-almost-sorted-array-where-only-two-elements-are-swapped/ 3) Delete all nodes whose value is greater than K 2nd Round (1 hr 30 mins) 1) Clone a Binary… Read More »

## Clustering/Partitioning an array such that sum of square differences is minimum

Given an array of n numbers and a number k. We need to divide the array into k partitions (clusters) of same or different length.… Read More »

## Binary representation of next number

Given a binary input that represents binary representation of positive number n, find binary representation of n+1. The binary input may be and may not… Read More »

## Threaded Binary Tree | Insertion

We have already discuss the Binary Threaded Binary Tree. Insertion in Binary threaded tree is similar to insertion in binary tree but we will have… Read More »

## Find whether it is possible to make array elements same using one external number

Given an Array, three operations can be performed using any external number x. Add x to an element once Subtract x from an element once… Read More »

## SQL | UNIQUE Constraint

SQL Constraints Unique constraint in SQL is used to check whether the sub query has duplicate tuples in it’s result. It returns a boolean value… Read More »

## SQL | Create Table Extension

SQL provides an extension for CREATE TABLE clause that creates a new table with the same schema of some existing table in the database. It… Read More »

## SQL | CHECK Constraint

SQL Constraints Check Constraint is used to specify a predicate that every tuple must satisfy in a given relation. It limits the values that a… Read More »