Professional Documents
Culture Documents
Question :01
Find the element that appears once in an array where every other element
appears twice
Write an efficient program to find the sum of contiguous subarray within a one-
dimensional array of numbers which has the largest sum.
Question :03
Given a sorted array and a target value, return the index if the target is found. If not,
return the index where it would be if it were inserted in order. You may assume no
duplicates in the array.
[1,3,5,6], 5 -> 2
[1,3,5,6], 2 -> 1
[1,3,5,6], 7 -> 4
[1,3,5,6], 0 -> 0
Question :04
Given a set of non-negative integers, and a value sum, determine if there is a subset of the
given set with sum equal to given sum.
Let isSubSetSum(int set[], int n, int sum) be the function to find whether there is a subset of set[]
with sum equal to sum. n is the number of elements in set[].
If any of the above the above subproblems return true, then return true
LINKED LIST
DECLARATION:
Given a singly linked list and a position, delete a linked list node at the given
position.
Input: position = 1, Linked List = 8->2->3->1->7
Output: Linked List = 8->3->1->7
Given a singly linked list, find middle of the linked list. For example, if
given linked list is 1->2->3->4->5 then output should be 3.
If there are even nodes, then there would be two middle nodes, we need
to print second middle element. For example, if given linked list is 1->2-
>3->4->5->6 then output should be 4.
Question:03
• Pop: Removes an item from the stack. The items are popped in the reversed
order in which they are pushed. If the stack is empty, then it is said to be an
Underflow condition.
Find all the elements in an array that are greater than the elements to right
Example:
Input {10,4,6,5,3}
Output :5,6,10
Question:
Input : ((()
Output : 2
Explanation : ()
Input: )()())
Output : 4
Explanation: ()()
Procedure:
Question :
You are given N elements and your task is to Implement a Stack in which you
can get minimum element in O(1) time
1.Push operations
2.Pop operations
3. Min operations
IMPLEMENTATION
QUEUE:
Operations
Question:01
Given a string containing of ‘0’, ‘1’ and ‘?’ wildcard characters, generate all binary strings
that can be formed by replacing each wildcard character by ‘0’ or ‘1’.
Tree Traversals