A very popular competitive coding challenge in which we have to save the prisoner. Not in real guys, just for this challenge.So here we are A jailer want to distribute some(e.g 5 ) sweets to number of prisoners (6). All the prisoners have id from 1 to n and are sitting in a circular way, sweet can be distributed from anywhere (from the 2nd prisoner). But Last sweet is poisonous we have to warn that prisoner who will eat last sweet.
Home » Algorithm
As you all know, NEC Technology is a leading IT MNC in India.We Computer science students always want to be a part of NEC.As usual, NEC Tech came in AMU for placement in 2016 for MCA and B Tech Students. In this article, you will know about the standard of NEC interviews and written papers, and you will learn different methods to solve these problems.
Solution of Non-Divisible Subset Hackerrank problem Given a set, S, of n distinct integers, print the size of a maximal subset, S’, of S where the sum of any 2 numbers in S’ is not evenly divisible by k. Input Format The first line contains 2 space-separated integers, n and k, respectively. The second line contains n space-separated integers (we’ll refer to the ith value as ai) describing the unique values of the set. Constraints 1<=k<=10 1<=n<=10^5 1<=ai<=10^9 All of …
Binary search is the most popular method to find or search an element from an array, In this article, we will discuss that how linear search and binary are different and we will see how to find first or the Last occurrence of a number using Binary Search
No matter how big the array is, the user could still have more input. or If the user doesn't have that much input, you have wasted memory.To overcome this problem we use runtime memory allocation. In this article, we will learn about dynamic allocation and dynamic data structures.