Netapp interview – Set 1

I am from MNIT Jaipur. I appeared for Netapp campus interview for developer profile recently. I would like to contribute for CrazyforCode by sharing my experience. First a written round was conducted. Written was based on Programming, Data structure, OS and Aptitude/Quant. Round 1 → explain your internship project. Q1. Define IP tables. Q2. Write Read More →

Longest Increasing Subsequence

Problem: Find length of the subsequence of a given sequence in which the subsequence elements are in sorted order, lowest to highest, and in which the subsequence is as long as possible. This subsequence is not necessarily contiguous, or unique. Example : {10, 25, 9, 30, 21, 55, 40, 60, 75} Here Length of LIS Read More →

Find sub-array whose sum equal to a given number

Given an array of non negative ints, is it possible to choose a sub array, such that the sum is equal to the given target? Example: Input : arr[] = {2, 4, 8}, target = 12 Output : true.(because 4+ 8 = 12(target sum)) Input : arr[] = {2, 4, 8}, target = 10 Output Read More →

Move last node to front in linked list

Write a C function that moves last element to front in a given Singly Linked List. For example, if the given Linked List is 1->2->3->4->5, then the function should change the list to 5->1->2->3->4. 1) Traverse the linked list till last node. 2) Use two pointers – one points to last node and other to Read More →

Root to leaf path with sum equal to given sum

Given a binary tree and a number,Write a function to find out whether there is a path from root to leaf with sum equal to given Number. In above tree, root to leaf paths exists for following sum. 7=> 1->2->4 9=> 1->3->5 10=>1->3->6 Implementation :

Mirror image of a binary tree

mirrorImage

Write a program to create a mirror copy of a binary tree i.e. left nodes become right and right nodes become left. Solution 1 : Following program will create a new mirror tree. Solution 2: This program will convert tree into it’s mirror tree.

Cisco Interview – Set 1

Round 1 (WRITTEN TEST) Total Duration : 1 hour Total 2 sections a) 30 Questions Aptitude and Reasoning b) 30 Questions Technical C/C++, data Structure, OS, Networking Round 2 Q1. Iterative Preorder, Inorder, Postorder Explain with example Q2. Micorprocessors Q3. Sliding window protocol Q4. OSI layers Q5 About projects Round 3 Q1. Minimum Spanning tree Read More →

Remove characters from input string that are present in mask string

Write a C program that takes two strings as arguments and removes the characters from first string which are present in second string called mask string. ex: str1 “crazy for code” str2 “cod” Result: “razy e” Steps: 1) Get count array from mask string which stores count of chars from mask string. 2) Check for Read More →

Level of a given node in binary tree

Given a Binary Tree and a pointer to the Node in that tree. Write a function to find level of Node in the Tree. For Example, in the below tree            0        /   \      1      4    /  \    /  \  2   3    5    6 If the input key Read More →

Check if a binary tree is subtree of another tree

Given two binary trees T1 and T2, Find whether T2 is a subtree of T1.T1 has millions of nodes and T2 has hundreds of nodes. Solution: Traverse T1 in pre-order fashion. For each node, check if the subtree rooted at this node is identical (exactly same) as T2.

Prisoners and Hats Puzzle

hatpuzzle

Problem: Four prisoners are arrested for a crime, but the jail is full and the jailer has nowhere to put them. He eventually comes up with the solution of giving them a puzzle so if they succeed they can go free but if they fail they are executed. The jailer puts three of the men Read More →

Mysql Query – Set 6

We have 3 tables Highschooler, Friend, Likes as shown below: Highschooler ( ID, name, grade ) There is a high school student with unique ID and a given first name in a certain grade. Friend ( ID1, ID2 ) The student with ID1 is friends with the student with ID2. Friendship is mutual, so if Read More →