Filter interviews by
Be the first one to contribute and help others!
Yes, I know C language. Here's a program to print numbers from 1 to 10 excluding 5.
Use a loop to iterate from 1 to 10
Inside the loop, check if the current number is equal to 5
If it is not equal to 5, print the number
The question was about finding the average of a set of numbers.
I approached the problem by first summing all the numbers in the set.
Then, I divided the sum by the total number of elements in the set to find the average.
I used a loop to iterate through the set and keep track of the sum and count of elements.
Print the level order traversal of binary tree in spiral form
Perform level order traversal of the binary tree
Alternate the direction of traversal for each level
Use a stack to reverse the order of nodes in each level
Print the nodes in the order of traversal
Find the maximum element in each subarray of size k in a given array.
Iterate through the array from index 0 to n-k.
For each subarray of size k, find the maximum element.
Store the maximum elements in a separate array.
Return the array of maximum elements.
To find the Kth largest element in two sorted arrays, we can use the merge step of merge sort algorithm.
Merge the two arrays into a single sorted array using a modified merge sort algorithm.
Return the Kth element from the merged array.
Merge two sorted arrays into one sorted array with expected time complexity of (m+n).
Use a two-pointer approach to compare elements from both arrays and merge them into the first array.
Start comparing elements from the end of both arrays and place the larger element at the end of the first array.
Continue this process until all elements from the second array are merged into the first array.
TCS
Accenture
Wipro
Cognizant