Add office photos
Engaged Employer

HashedIn by Deloitte

4.2
based on 409 Reviews
Video summary
Proud winner of ABECA 2024 - AmbitionBox Employee Choice Awards
Filter interviews by

50+ The Creek Planet School - Venus Campus Interview Questions and Answers

Updated 25 Jul 2024
Popular Designations

Q1. Chocolate Pickup Problem

Ninja has a 'GRID' of size 'R' x 'C'. Each cell of the grid contains some chocolates. Ninja has two friends, Alice and Bob, and he wants to collect as many chocolates as possible with t...read more

Ans.

Find the maximum number of chocolates that can be collected by two friends moving in a grid.

  • Start from the top-left and top-right corners, move diagonally down to collect chocolates

  • Calculate the total chocolates collected by each friend and sum them up for the final result

  • Consider all possible paths for both friends to maximize the total chocolates collected

Add your answer

Q2. Find K'th Character of Decrypted String

You are given an encrypted string where repeated substrings are represented by the substring followed by its count. Your task is to find the K'th character of the decrypt...read more

Ans.

Given an encrypted string with repeated substrings represented by counts, find the K'th character of the decrypted string.

  • Parse the encrypted string to extract substrings and their counts

  • Iterate through the substrings and counts to build the decrypted string

  • Track the position in the decrypted string to find the K'th character

Add your answer

Q3. Reverse the Linked List

Given a singly linked list of integers, your task is to return the head of the reversed linked list.

Input:

The first line of input contains an integer 'T' representing the number of tes...read more
Ans.

Reverse a singly linked list of integers in O(N) time and O(1) space complexity.

  • Iterate through the linked list, reversing the pointers to point to the previous node instead of the next node.

  • Use three pointers to keep track of the current, previous, and next nodes while reversing the list.

  • Update the head of the reversed linked list as the last node encountered during the reversal process.

  • Example: Given 1 -> 2 -> 3 -> 4 -> NULL, reverse it to get 4 -> 3 -> 2 -> 1 -> NULL with ...read more

Add your answer

Q4. Leaders in an Array Problem Statement

Given a sequence of numbers, the task is to identify all the leaders within this sequence. An element is considered a leader if it is strictly greater than all the elements...read more

Ans.

Identify all the leaders in a sequence of numbers, where a leader is greater than all elements to its right.

  • Iterate through the sequence from right to left, keeping track of the maximum element encountered so far.

  • If an element is greater than the maximum element encountered so far, it is a leader.

  • Add the leaders to a result sequence while maintaining the original order.

  • The rightmost element is always a leader.

Add your answer
Discover The Creek Planet School - Venus Campus interview dos and don'ts from real experiences

Q5. Trailing Zeros in Factorial Problem

Find the number of trailing zeroes in the factorial of a given number N.

Input:

The first line contains an integer T representing the number of test cases.
Each of the followi...read more
Ans.

Count the number of trailing zeros in the factorial of a given number.

  • Trailing zeros are created by pairs of 2 and 5 in the factorial.

  • Count the number of 5s in the prime factorization of N to find the trailing zeros.

  • For example, for N=10, there are 2 trailing zeros as there are two 5s in the prime factorization of 10.

Add your answer

Q6. Maximum Subarray Sum Problem Statement

Given an array arr of length N consisting of integers, find the sum of the subarray (including empty subarray) with the maximum sum among all subarrays.

Explanation:

A sub...read more

Ans.

Find the sum of the subarray with the maximum sum among all subarrays in a given array.

  • Iterate through the array and keep track of the maximum sum subarray seen so far.

  • At each index, decide whether to include the current element in the subarray or start a new subarray.

  • Update the maximum sum subarray if the current sum is greater than the previous maximum sum.

Add your answer
Are these interview questions helpful?

Q7. Find Two Missing Numbers Problem Statement

Given an array of unique integers where each element is in the range [1, N], and the size of the array is (N - 2), there are two numbers missing from this array. Your ...read more

Ans.

Given an array of unique integers with two missing numbers, find and return the missing numbers.

  • Iterate through the array and mark the presence of each number in a separate boolean array.

  • Iterate through the boolean array to find the missing numbers.

  • Return the missing numbers in increasing order.

Add your answer

Q8. Convert a Number to Words

Given an integer number num, your task is to convert 'num' into its corresponding word representation.

Input:

The first line of input contains an integer ‘T’ denoting the number of tes...read more
Ans.

Convert a given integer number into its corresponding word representation.

  • Implement a function that converts the given number into words by breaking it down into its individual digits and mapping them to their word representation.

  • Handle special cases like numbers less than 20, multiples of 10, and numbers in the hundreds and thousands place.

  • Ensure that there is a space between every two consecutive words and all characters are in English lowercase letters.

Add your answer
Share interview questions and help millions of jobseekers 🌟

Q9. Convert Binary Tree to Mirror Tree Problem Statement

Given a binary tree, convert this binary tree into its mirror tree. A binary tree is a tree in which each parent node has at most two children. The mirror of...read more

Ans.

Convert a binary tree into its mirror tree by interchanging left and right children of non-leaf nodes.

  • Traverse the binary tree in a recursive manner.

  • Swap the left and right children of each non-leaf node.

  • Continue this process until all nodes are visited.

  • Example: Input binary tree: 1 2 3 4 -1 5 6 -1 7 -1 -1 -1 -1 -1 -1, Output mirror tree: 1 3 2 6 5 4 -1 -1 -1 -1 -1 7 -1 -1 -1

Add your answer

Q10. Min Jumps Problem Statement

In Ninja town, represented as an N * M grid, people travel by jumping over buildings in the grid's cells. Santa is starting at cell (0, 0) and must deliver gifts to cell (N-1, M-1) o...read more

Ans.

Santa needs to find the quickest path to deliver gifts in Ninja town by jumping over buildings with least travel time.

  • Santa starts at (0, 0) and needs to deliver gifts to (N-1, M-1) on Christmas Eve.

  • Santa can jump to (x+1, y+1), (x+1, y), or (x, y+1) from any cell (x, y) within grid boundaries.

  • Travel time between two buildings equals the absolute difference in their heights.

  • Find the quickest path with least travel time using dynamic programming or Dijkstra's algorithm.

Add your answer

Q11. Four Sum Problem Statement

You are provided with an array/list 'ARR' consisting of 'N' integers and an integer 'TARGET'. The task is to determine if there exist four distinct numbers in 'ARR' such that their su...read more

Ans.

The task is to determine if there exist four distinct numbers in an array that sum up to a given target value.

  • Iterate through all possible combinations of four distinct numbers in the array.

  • Use a nested loop to check all combinations efficiently.

  • Keep track of the sum of each combination and compare it with the target value.

  • Return 'Yes' if a valid combination is found, otherwise return 'No'.

Add your answer

Q12. Detect and Remove Loop in Linked List

For a given singly linked list, identify if a loop exists and remove it, adjusting the linked list in place. Return the modified linked list.

Expected Complexity:

Aim for a...read more

Ans.

Detect and remove loop in a singly linked list in place with O(n) time complexity and O(1) space complexity.

  • Use Floyd's Tortoise and Hare algorithm to detect the loop in the linked list.

  • Once the loop is detected, find the start of the loop using the same algorithm.

  • Adjust the pointers to remove the loop and return the modified linked list.

  • Example: For input 5 2 and elements 1 2 3 4 5, output should be 1 2 3 4 5.

Add your answer

Q13. Lowest Common Ancestor in a BST Problem Statement

You're provided with a Binary Search Tree (BST) containing 'N' nodes with integer values and two specific nodes, 'P' and 'Q'.

Your task is to identify the lowes...read more

Ans.

Find the lowest common ancestor of two nodes in a Binary Search Tree.

  • Traverse the BST from the root to find the LCA of the given nodes.

  • Compare the values of the nodes with the values of P and Q to determine the LCA.

  • Handle cases where one node is the ancestor of the other or when one of the nodes is the root.

  • Use recursion to efficiently find the LCA in the BST.

  • Consider edge cases such as when the nodes are not present in the BST.

Add your answer

Q14. Merge K Sorted Arrays Problem Statement

Given 'K' different arrays that are individually sorted in ascending order, merge all these arrays into a single array that is also sorted in ascending order.

Input

The f...read more
Ans.

Merge K sorted arrays into a single sorted array.

  • Create a min-heap to store the first element of each array along with the array index.

  • Pop the smallest element from the heap and add it to the result array.

  • If the array from which the element was popped has more elements, add the next element to the heap.

  • Repeat until all elements are merged into a single sorted array.

Add your answer

Q15. Find All Pairs Adding Up to Target

Given an array of integers ARR of length N and an integer Target, your task is to return all pairs of elements such that they add up to the Target.

Input:

The first line conta...read more
Ans.

Given an array of integers and a target, find all pairs of elements that add up to the target.

  • Iterate through the array and for each element, check if the target - element exists in a hash set.

  • If it exists, add the pair to the result. If not, add the element to the hash set.

  • Handle cases where the same element is used twice to form a pair.

  • Return (-1, -1) if no pair is found.

Add your answer

Q16. Container With Most Water Problem Statement

Given a sequence of ‘N’ non-negative integers, A[1], A[2], ..., A[i], ..., A[N], where each number represents the height of a vertical line drawn at position 'i'. On ...read more

Ans.

Find two lines to form a container with maximum water holding capacity.

  • Use two pointers approach to find the maximum area by calculating the area between the lines and moving the pointers based on the height of the lines.

  • Keep track of the maximum area found so far.

  • The area is calculated as the minimum of the two line heights multiplied by the distance between the lines.

  • Example: For input A = [1,8,6,2,5,4,8,3,7], the maximum area is 49 between lines at indices 1 and 8.

Add your answer

Q17. Group Anagrams Problem Statement

Given an array or list of strings called inputStr, your task is to return the strings grouped as anagrams. Each group should contain strings that are anagrams of one another.

An...read more

Ans.

Group anagrams in an array of strings based on character frequency.

  • Iterate through each string in the input array

  • For each string, sort the characters and use the sorted string as a key in a hashmap to group anagrams

  • Return the grouped anagrams as output

Add your answer

Q18. Sort 0 1 2 Problem Statement

Given an integer array arr of size 'N' containing only 0s, 1s, and 2s, write an algorithm to sort the array.

Input:

The first line contains an integer 'T' representing the number of...read more
Ans.

Sort an array of 0s, 1s, and 2s in linear time complexity.

  • Use three pointers to keep track of 0s, 1s, and 2s while iterating through the array.

  • Swap elements based on the values encountered to sort the array in-place.

  • Time complexity should be O(N) and space complexity should be O(1).

Add your answer

Q19. Minimum Number of Platforms Needed Problem Statement

You are given the arrival and departure times of N trains at a railway station for a particular day. Your task is to determine the minimum number of platform...read more

Ans.

Determine the minimum number of platforms needed at a railway station based on arrival and departure times of trains.

  • Sort the arrival and departure times in ascending order.

  • Use two pointers to keep track of overlapping schedules.

  • Increment the platform count when a new train arrives before the previous one departs.

  • Return the maximum platform count needed.

Add your answer

Q20. Lowest Common Ancestor (LCA) Problem Statement

Understanding the concept of Lowest Common Ancestor (LCA) in graph theory and computer science is essential.

Consider a rooted tree ‘T’ containing ‘N’ nodes. The L...read more

Ans.

The Lowest Common Ancestor (LCA) problem involves finding the lowest node in a tree that is an ancestor of two given nodes.

  • LCA is the lowest node in a tree that is an ancestor of both given nodes.

  • The tree is rooted at node 1 for each test case.

  • Paths from each node to the root are considered to find the LCA.

  • Constraints include the number of test cases, nodes, queries, and node values.

  • Time limit for the solution is 1 second.

Add your answer

Q21. Last Stone Weight Problem Statement

We have a set collection of N stones, and each stone has a given positive integer weight. On each turn, select the two stones with the maximum weight and smash them together....read more

Ans.

Find the weight of the last stone remaining after smashing stones together.

  • Sort the stones in descending order.

  • Simulate the smashing process by repeatedly smashing the two heaviest stones until only one stone is left.

  • Return the weight of the last stone, or 0 if no stone is left.

Add your answer

Q22. Cycle Detection in a Singly Linked List

Determine if a given singly linked list of integers forms a cycle or not.

A cycle in a linked list occurs when a node's next points back to a previous node in the list. T...read more

Ans.

Detect if a singly linked list forms a cycle by checking if a node's next points back to a previous node.

  • Use Floyd's Tortoise and Hare algorithm to detect a cycle in the linked list.

  • Maintain two pointers, slow and fast, where slow moves one step at a time and fast moves two steps at a time.

  • If there is a cycle, the fast pointer will eventually meet the slow pointer.

  • If the fast pointer reaches the end of the list (null), there is no cycle.

  • Time complexity: O(N), Space complexity...read more

Add your answer

Q23. Anagram Pairs Verification Problem

Your task is to determine if two given strings are anagrams of each other. Two strings are considered anagrams if you can rearrange the letters of one string to form the other...read more

Ans.

Check if two strings are anagrams of each other by comparing their sorted characters.

  • Sort the characters of both strings and compare them.

  • Use a dictionary to count the frequency of characters in each string and compare the dictionaries.

  • Ensure both strings have the same length before proceeding with the comparison.

  • Example: For input 'str1 = "spar", str2 = "rasp"', the output should be True.

Add your answer

Q24. Longest Mountain Subarray Problem Statement

Given an array of integers denoting the heights of the mountains, find the length of the longest subarray that forms a mountain shape.

A mountain subarray is defined ...read more

Ans.

Find the length of the longest mountain subarray in an array of integers.

  • Identify peaks in the array where the elements transition from ascending to descending order.

  • Calculate the length of the mountain subarray starting from each peak.

  • Track the length of the longest mountain subarray found so far.

  • Consider edge cases like when there are no mountains in the array.

Add your answer

Q25. Triplets with Given Sum Problem

Given an array or list ARR consisting of N integers, your task is to identify all distinct triplets within the array that sum up to a specified number K.

Explanation:

A triplet i...read more

Ans.

The task is to find all distinct triplets in an array that sum up to a specified number.

  • Iterate through all possible triplets using three nested loops.

  • Check if the sum of the triplet equals the target sum.

  • Print the triplet if found, else print -1.

Add your answer

Q26. Remove Duplicates from String Problem Statement

You are provided a string STR of length N, consisting solely of lowercase English letters.

Your task is to remove all duplicate occurrences of characters in the s...read more

Ans.

Remove duplicates from a string of lowercase English letters.

  • Use a set to keep track of unique characters seen so far.

  • Iterate through the string and add each character to the set if it hasn't been seen before.

  • Construct a new string by appending characters that are not in the set.

Add your answer

Q27. String Palindrome Verification

Given a string, your task is to determine if it is a palindrome considering only alphanumeric characters.

Input:

The input is a single string without any leading or trailing space...read more
Ans.

Determine if a given string is a palindrome considering only alphanumeric characters.

  • Remove non-alphanumeric characters from the input string.

  • Compare characters from start and end of the string to check for palindrome.

  • Handle edge cases like empty string or single character input.

Add your answer

Q28. Longest Increasing Subsequence Problem Statement

Given an array of integers with 'N' elements, determine the length of the longest subsequence where each element is greater than the previous element. This subse...read more

Ans.

Find the length of the longest strictly increasing subsequence in an array of integers.

  • Use dynamic programming to solve this problem efficiently.

  • Initialize an array to store the length of the longest increasing subsequence ending at each index.

  • Iterate through the array and update the length of the longest increasing subsequence for each element.

  • Return the maximum value in the array as the result.

Add your answer
Q29. Can you describe a situation where you were given a schema and asked to write SQL queries based on it?
Ans.

Yes, I was given a schema and asked to write SQL queries based on it.

  • I was given a schema for a database that included tables, columns, and relationships between them.

  • I had to write SQL queries to retrieve specific data from the database based on the schema provided.

  • For example, I was asked to write a query to retrieve all customers who made a purchase in the last month.

  • I had to understand the schema to correctly write the queries and ensure they returned the desired results.

Add your answer
Q30. How would you design a social media platform with features such as friend requests and posts?
Ans.

Designing a social media platform with friend requests and posts.

  • Implement user profiles with friend request functionality.

  • Allow users to create and share posts on their profiles.

  • Include news feed to display posts from friends.

  • Implement notifications for friend requests and post interactions.

  • Include privacy settings for posts and friend requests.

  • Consider implementing features like comments, likes, and shares for posts.

Add your answer

Q31. Write code to find max length subarray matching the given sum

Ans.

Code to find max length subarray matching the given sum

  • Use a sliding window approach to iterate through the array

  • Keep track of the current sum and the maximum length subarray

  • If the current sum exceeds the given sum, move the window's left pointer

  • If the current sum matches the given sum, update the maximum length subarray

  • Return the maximum length subarray

Add your answer
Q32. Can you describe the design of a banking system?
Ans.

A banking system is a software application that allows customers to perform financial transactions, manage accounts, and access banking services.

  • The system should have user authentication and authorization mechanisms to ensure security.

  • It should support various types of accounts such as savings, checking, and loans.

  • The system should allow customers to deposit, withdraw, transfer funds, and view transaction history.

  • It should have features like bill payment, account statements,...read more

Add your answer
Q33. Design a music player similar to Spotify.
Ans.

Design a music player similar to Spotify.

  • Implement user authentication for personalized playlists and recommendations

  • Create a user-friendly interface with features like search, shuffle, repeat, and create playlists

  • Integrate a recommendation system based on user listening history and preferences

Add your answer

Q34. Write an SQL query to given an output from given tables

Ans.

SQL query to retrieve output from given tables

  • Identify the tables and their relationships

  • Determine the columns to be selected

  • Use appropriate join and filter conditions

  • Group and aggregate data if required

Add your answer

Q35. Designing of APIs, SQL query to find second largest value

Ans.

Designing APIs and finding second largest value in SQL query.

  • For API design, consider RESTful principles and use clear and concise naming conventions.

  • For finding second largest value in SQL, use ORDER BY and LIMIT clauses.

  • Consider edge cases such as duplicates and null values.

  • Test thoroughly to ensure correct functionality.

Add your answer

Q36. Write CLI snake and ladders game code

Ans.

CLI snake and ladders game code

  • Create a board with 100 cells using a 10x10 array

  • Define snakes and ladders positions as an array of tuples

  • Use a loop to alternate player turns and move them based on dice roll

  • Check for snakes and ladders and update player position accordingly

  • Print the board after each turn and declare winner when a player reaches cell 100

Add your answer

Q37. Sort an array of 0s,1s,2s in O(n) time.

Ans.

Sort an array of 0s, 1s, 2s in linear time.

  • Use three pointers to keep track of the positions of 0s, 1s, and 2s.

  • Traverse the array once and swap elements based on their values.

  • The final array will have 0s, 1s, and 2s grouped together in that order.

Add your answer

Q38. Find if pair sum exists in array

Ans.

Check if there exists a pair of numbers in the array that add up to a given sum.

  • Iterate through the array and for each element, check if the difference between the sum and the element exists in the array using a hash table.

  • Alternatively, sort the array and use two pointers to traverse from both ends towards the middle, adjusting the pointers based on the sum of the current pair.

Add your answer

Q39. Why do you want to join hashedin.

Ans.

I want to join Hashedin because of its reputation for innovative projects and collaborative work environment.

  • Reputation for innovative projects

  • Collaborative work environment

  • Opportunities for growth and learning

Add your answer

Q40. Method overloading vs Method overriding

Ans.

Method overloading is having multiple methods with the same name but different parameters. Method overriding is having a subclass method with the same name and parameters as a superclass method.

  • Method overloading is used to provide different ways of calling the same method with different parameters.

  • Method overriding is used to provide a specific implementation of a method in a subclass that is already defined in a superclass.

  • Method overloading is resolved at compile-time base...read more

Add your answer

Q41. Kth smallest element in array

Ans.

Finding the Kth smallest element in an array.

  • Sort the array and return the Kth element.

  • Use a min heap to find the Kth smallest element.

  • Use quickselect algorithm to find the Kth smallest element.

  • Divide and conquer approach using binary search.

  • Use selection algorithm to find the Kth smallest element.

Add your answer

Q42. rotate a array k times

Ans.

Rotate an array of strings k times

  • Create a temporary array to store elements that will be rotated

  • Use modulo operator to handle cases where k is greater than array length

  • Update the original array with elements from the temporary array

Add your answer

Q43. what is abstraction and encapsulation

Ans.

Abstraction is the concept of hiding complex implementation details and showing only the necessary information. Encapsulation is bundling data and methods that operate on the data into a single unit.

  • Abstraction focuses on what an object does rather than how it does it

  • Encapsulation restricts access to some of an object's components, protecting the object's integrity

  • Abstraction allows for creating simple interfaces for complex systems

  • Encapsulation helps in achieving data hiding...read more

Add your answer

Q44. 2 sum using linked list

Ans.

Use a hash table to find two numbers in a linked list that add up to a target sum.

  • Traverse the linked list and store each node's value in a hash table along with its index.

  • For each node, check if the difference between the target sum and the current node's value exists in the hash table.

  • If it does, return the indices of the two nodes.

  • Example: Given linked list 2 -> 4 -> 3 -> 5 and target sum 7, return indices 1 and 2.

Add your answer

Q45. Design a database for instagram

Ans.

Database design for Instagram platform

  • Create tables for users, posts, comments, likes, followers, and hashtags

  • Use primary and foreign keys to establish relationships between tables

  • Include fields such as user_id, post_id, comment_id, like_id, follower_id, and hashtag_id

  • Implement indexes for faster data retrieval

  • Consider scalability and performance optimization techniques

Add your answer

Q46. what is multiple inheritance

Ans.

Multiple inheritance is a feature in object-oriented programming where a class can inherit attributes and methods from more than one parent class.

  • Allows a class to inherit attributes and methods from multiple parent classes

  • Can lead to the Diamond Problem where ambiguity arises if two parent classes have a method with the same name

  • Languages like C++ support multiple inheritance

Add your answer

Q47. Code transpose of matrix

Ans.

Transpose a matrix by swapping rows with columns

  • Iterate through each row and column and swap the elements

  • Create a new matrix with swapped rows and columns

  • Ensure the new matrix has the correct dimensions

Add your answer

Q48. Implement swap method.

Ans.

Implement a swap method for two variables.

  • Create a temporary variable to store the value of one variable.

  • Assign the value of the second variable to the first variable.

  • Assign the value of the temporary variable to the second variable.

Add your answer

Q49. Depth of a binary tree

Ans.

The depth of a binary tree is the number of edges on the longest path from the root node to a leaf node.

  • Depth of a binary tree can be calculated recursively by finding the maximum depth of the left and right subtrees and adding 1.

  • The depth of a binary tree with only one node (the root) is 0.

  • Example: For a binary tree with root node A, left child B, and right child C, the depth would be 1.

Add your answer

Q50. Middle of linked list.

Ans.

To find the middle element of a linked list, use two pointers - one moving at double the speed of the other.

  • Use two pointers - slow and fast, with fast moving at double the speed of slow.

  • When fast reaches the end of the list, slow will be at the middle element.

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos

Interview Process at The Creek Planet School - Venus Campus

based on 8 interviews
4 Interview rounds
Coding Test Round
Video Call Round - 1
Video Call Round - 2
HR Round
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Software Developer Interview Questions from Similar Companies

3.7
 • 243 Interview Questions
3.5
 • 46 Interview Questions
3.7
 • 35 Interview Questions
3.5
 • 18 Interview Questions
3.6
 • 12 Interview Questions
3.7
 • 12 Interview Questions
View all
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
70 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter