Filter interviews by
Be the first one to contribute and help others!
The person can escape the island by creating a firebreak or finding a body of water.
Create a firebreak by clearing a path of grass around oneself to prevent the fire from spreading.
Look for a body of water such as a lake, river, or ocean to escape the fire.
If no water source is available, try to find a sheltered area with less dry grass to wait for the fire to pass.
Use any available tools or materials to help create a
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.
based on 2 reviews
Rating in categories
TCS
Accenture
Wipro
Cognizant