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
The students of computer science have a nightmare about the pointer, It's difficult to learn pointer but it's more difficult when we want to implement it. We normally face 3 types of problem What do u mean by &a and *a or **&a if *a is used in method overloading then when it is not used, or when it is useful Find the output of this program if the statements are like
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.