80+ KESCo Interview Questions and Answers
Q1. Painter's Partition Problem Statement
Given an array/list representing boards, where each element denotes the length of a board, and a number ‘K’ of available painters, determine the minimum time required to pa...read more
Determine the minimum time required to paint all boards with given constraints.
Use binary search to find the minimum and maximum possible time to paint all boards.
Iterate through the boards and assign them to painters based on the time constraints.
Calculate the total time taken to paint all boards with the assigned painters.
Q2. Special Numbers Problem Statement
Your task is to find the total count of special numbers within a range from 1 to a given integer, 'MAXVAL'. A special number is defined as a number whose digits, when rotated 1...read more
Count the total number of special numbers within a given range by rotating digits 180 degrees.
Create a function to check if a number is a special number by rotating its digits.
Iterate through the range from 1 to MAXVAL and count the special numbers.
Handle the digit rotation mapping for 0, 1, 6, 8, 9.
Return the count of special numbers for each test case.
Q3. Chocolate Distribution Problem
You are given an array/list CHOCOLATES
of size 'N', where each element represents the number of chocolates in a packet. Your task is to distribute these chocolates among 'M' stude...read more
Distribute chocolates among students to minimize the difference between the largest and smallest number of chocolates.
Sort the array of chocolates.
Use sliding window technique to find the minimum difference between the largest and smallest number of chocolates.
Return the minimum difference as the output.
Q4. Say you have three tables WORK, USERS, MANAGERS WORK - work_id - user_id - how_much USERS - user_id - team MANAGERS - manager_id - team If I am a manager, write a select statement to retrieve the work of all us...
read moreWrite a select statement to retrieve work of all users who belong to my team.
Join USERS and WORK tables on user_id
Join MANAGERS and USERS tables on team
Filter by manager_id
Q5. Minimum and Maximum Candy Cost Problem
Ram is in Ninjaland, visiting a unique candy store offering 'N' candies each with different costs. The store has a special offer: for every candy you purchase, you can tak...read more
Find minimum and maximum cost to purchase all candies with special offer of free candies.
Iterate through the candy costs array and sort it in ascending order.
For minimum cost, start from the lowest cost candy and take free candies until reaching the next higher cost candy.
For maximum cost, start from the highest cost candy and take free candies until reaching the next lower cost candy.
Q6. Min Steps to One Using Dynamic Programming
Given a positive integer N
, your task is to determine the minimum number of steps required to reduce N
to 1.
Allowed Operations:
1) Subtract 1 from it: n = n - 1
2) If ...read more
Find the minimum number of steps to reduce a positive integer to 1 using given operations.
Use dynamic programming to store the minimum steps for each number from 1 to N.
Iterate through each number from 1 to N and calculate the minimum steps based on the given operations.
Consider the cases where you can either subtract 1, divide by 2, or divide by 3 to find the minimum steps.
Return the minimum steps needed to reduce the number to 1 for each test case.
Q7. Problem Statement: Minimize the Maximum
You are given an array of integers and an integer K
. For each array element, you can adjust it by increasing or decreasing it by a value of K
. Your goal is to minimize th...read more
Given an array of integers and an integer K, minimize the difference between the maximum and minimum elements after adjusting each element by +/- K.
Sort the array in non-decreasing order.
For each element, calculate the difference between the current element and the next element.
Adjust the element by adding or subtracting K to minimize the difference.
Return the minimum possible difference between the maximum and minimum elements.
Q8. Longest Palindromic Substring Problem Statement
You are provided with a string STR
of length N
. The goal is to identify the longest palindromic substring within this string. In cases where multiple palindromic ...read more
Identify the longest palindromic substring in a given string.
Iterate through the string and expand around each character to find palindromes
Keep track of the longest palindrome found
Return the longest palindrome with the smallest start index
Q9. Shopping Spree Problem Statement
Preeti plans to shop for her father's birthday at a store with unlimited quantities of N different items. She has a budget that allows her to buy a maximum of K items. Help Pree...read more
Calculate the number of ways Preeti can purchase items within budget, considering distinct ways.
Use dynamic programming to calculate the number of ways to purchase items within budget
Consider different scenarios where Preeti buys different quantities of each item
Return the result modulo 10^9 + 7 to handle large answers
Q10. Spell Checker Problem Statement
You are provided with a list of strings, DICTIONARY[]
, representing the correct spellings of words, and a query string QUERY
that may contain misspelled words. Your task is to ve...read more
Implement a spell checker function that suggests correct spellings from a dictionary for a given query string.
Iterate through the dictionary to check for matching prefixes with the query string.
Return a list of suggestions if the query string is misspelled, otherwise return an empty list.
Ensure all strings are in lowercase and within the specified constraints.
Handle multiple test cases as per the input format.
Example: For DICTIONARY[] = {"ninja", "ninjas", "nineteen", "ninny"...read more
Q11. Boyer Moore Algorithm for Pattern Searching
You are given a string text
and a string pattern
. Your task is to find all occurrences of pattern
in the string text
and return an array of indexes of all those occur...read more
Implement Boyer Moore Algorithm to find all occurrences of a pattern in a text string.
Implement Boyer Moore Algorithm for efficient pattern searching.
Iterate through the text string and compare the pattern with each substring of the text.
Return an array of indexes where the pattern is found in the text.
If pattern not found, return an array containing -1.
Q12. Farthest Distance From Lands Problem Statement
Given a binary square matrix 'ARR' with 'N' rows and 'N' columns, where '0' represents water and '1' represents land.
Determine the water cell whose distance to th...read more
Find the water cell farthest from land in a binary matrix using Manhattan distance.
Iterate through the matrix to find all land cells and water cells
Calculate the Manhattan distance of each water cell to the nearest land cell
Return the maximum distance found
Q13. Bridge in Graph Problem Statement
Given an undirected graph with V vertices and E edges, your task is to find all the bridges in this graph. A bridge is an edge that, when removed, increases the number of conne...read more
Find all the bridges in an undirected graph.
Use Tarjan's algorithm to find bridges in the graph.
A bridge is an edge whose removal increases the number of connected components.
Check for bridges by removing each edge and checking the number of connected components.
Return the edges that are bridges in non-decreasing order.
Q14. Running Median Problem
Given a stream of integers, calculate and print the median after each new integer is added to the stream.
Output only the integer part of the median.
Example:
Input:
N = 5
Stream = [2, 3,...read more
Calculate and print the median after each new integer is added to the stream.
Use two heaps - a max heap to store the smaller half of the numbers and a min heap to store the larger half.
Keep the sizes of the two heaps balanced or differ by at most 1 to get the median efficiently.
When a new integer is added, compare it with the current median and insert it into the appropriate heap.
If the sizes of the heaps differ by more than 1, rebalance them by moving an element from one hea...read more
Q15. The Skyline Problem
Compute the skyline of given rectangular buildings in a 2D city, eliminating hidden lines and forming the outer contour of the silhouette when viewed from a distance. Each building is descri...read more
Compute the skyline of given rectangular buildings in a 2D city, eliminating hidden lines and forming the outer contour of the silhouette.
Iterate through the buildings and create a list of critical points (x, y) where the height changes.
Sort the critical points based on x-coordinate and process them to form the skyline.
Merge consecutive horizontal segments of equal height into one to ensure no duplicates in the output.
Q16. Shortest Alternate Colored Path Problem
Given a directed graph consisting of 'N' nodes labeled from '0' to 'N-1'. Each edge in the graph is colored either 'red' or 'blue'. The graph may include self-edges and p...read more
The task is to compute the shortest path from node '0' to each node in a directed graph with alternating colored edges.
Create a graph using the given red and blue edges.
Use Breadth First Search (BFS) to find the shortest path from node '0' to each node with alternating colored edges.
If no such path exists, set the answer to -1.
Return the array of shortest path lengths for each node.
Q17. Covid Vaccination Distribution Problem
As the Government ramps up vaccination drives to combat the second wave of Covid-19, you are tasked with helping plan an effective vaccination schedule. Your goal is to ma...read more
Given constraints, find max vaccines administered on a specific day during a vaccination drive.
Iterate through each test case and calculate the maximum number of vaccines distributed on the specified day.
Distribute vaccines evenly across days while maximizing the number on the specified day.
Ensure that the sum of vaccines administered does not exceed the maximum allowed.
Consider edge cases like when the number of days is equal to the maximum number of vaccines available.
Q18. Alien Dictionary Problem Statement
You are provided with a sorted dictionary (by lexical order) in an alien language. Your task is to determine the character order of the alien language from this dictionary. Th...read more
Given a sorted alien dictionary, determine the character order of the alien language.
Create a graph data structure to represent the relationships between characters based on the given dictionary.
Perform a topological sort on the graph to determine the character order of the alien language.
Return the character array obtained from the topological sort as the final output.
Q19. Count Ways to Reach the N-th Stair Problem Statement
You are provided with a number of stairs, and initially, you are located at the 0th stair. You need to reach the Nth stair, and you can climb one or two step...read more
Count the number of distinct ways to climb to the Nth stair by climbing one or two steps at a time.
Use dynamic programming to solve the problem efficiently.
The number of ways to reach the Nth stair is the sum of the number of ways to reach the (N-1)th stair and the (N-2)th stair.
Handle base cases where N=0 and N=1 separately.
Apply modulo 10^9+7 to avoid overflow in the final result.
Q20. Problem: Ninja's Robot
The Ninja has a robot which navigates an infinite number line starting at position 0 with an initial speed of +1. The robot follows a set of instructions which includes ‘A’ (Accelerate) a...read more
Determine the minimum length of instruction sequence for a robot to reach a given target on an infinite number line.
Start at position 0 with speed +1, update position and speed based on 'A' and 'R' instructions
For each test case, find the shortest sequence of instructions to reach the target
Consider both positive and negative positions for the robot
Q21. Swap And Maximize Problem Statement
You are given a circular array consisting of N integers. Your task is to find the maximum sum of the absolute differences between adjacent elements by rearranging the array e...read more
Find the maximum sum of absolute differences between adjacent elements in a circular array by rearranging the elements.
Sort the array in non-decreasing order.
Alternate between picking the smallest and largest elements to maximize the sum of absolute differences.
Calculate the sum of absolute differences between adjacent elements in the rearranged array.
Q22. Find the Longest Palindromic Substring
Given a string ‘S’ composed of lowercase English letters, your task is to identify the longest palindromic substring within ‘S’.
If there are multiple longest palindromic ...read more
Find the longest palindromic substring in a given string, returning the rightmost one if multiple exist.
Use dynamic programming to check for palindromes within the string.
Keep track of the longest palindromic substring found so far.
Return the rightmost longest palindromic substring if multiple exist.
Q23. Pattern Matching Problem Statement
Given a pattern as a string and a set of words, determine if the pattern and the words list align in the same sequence.
Input:
T (number of test cases)
For each test case:
patte...read more
Given a pattern and a list of words, determine if the words align with the pattern.
Create a mapping between characters in the pattern and words in the list.
Check if the mapping preserves the order of characters in the pattern.
Return 'True' if the sequence of words matches the order of characters in the pattern, otherwise return 'False'.
Q24. a / b c / / d e f g Print the nodes in the following order: a, b, c, g, f, e, d, h, i, j, k, l ,m, n, o and so on. Which all data structures are used? Can we use just 1?
Multiple data structures are used to print nodes in a specific order. One data structure cannot be used alone.
The given order suggests a depth-first search traversal of a tree-like structure.
A stack can be used to keep track of the nodes to be visited.
A queue can be used to store the children of a node in the order they are visited.
An array can be used to store the nodes in the required order.
A linked list can be used to connect the nodes in the required order.
Using just one ...read more
Q25. Connecting Ropes with Minimum Cost
You are given 'N' ropes, each of varying lengths. The task is to connect all ropes into one single rope. The cost of connecting two ropes is the sum of their lengths. Your obj...read more
Connect ropes with minimum cost by merging two smallest ropes at a time.
Sort the array of rope lengths in ascending order.
Merge the two smallest ropes at a time and update the cost.
Repeat until all ropes are merged into one.
Return the total cost as the minimum cost to connect all ropes.
Q26. Median in a Stream Problem Statement
Your task is to determine the median of integers as they are read from a data stream. The median is the middle value in the ordered list of numbers. If the list length is ev...read more
Find median of integers in a data stream as they are read. Return medians after each new element.
Use a min heap to store the larger half of the numbers and a max heap to store the smaller half.
Keep the sizes of the two heaps balanced to efficiently find the median.
If the total number of elements is odd, the median is the top element of the max heap.
If the total number of elements is even, the median is the average of the top elements of both heaps.
Q27. If you had an opportunity to design the Google Suggest system, please let us know how you would approach it and how you would execute the plan in terms of settings up systems like(data stores or databases, inde...
read moreDesigning Google Suggest system
I would start by analyzing user search patterns and frequently searched keywords
Then, I would create a database of these keywords and their associated search results
I would use indexing services to quickly retrieve relevant results for each keyword
I would also implement machine learning algorithms to improve the accuracy of suggestions over time
Q28. Given n pens and n tops, each pen (and each top) having a size different than the other and each pen fitting exactly one top, find the largest pen using minimum number of comparisons. A comparison involves pick...
read moreFind largest pen using minimum comparisons with tops.
Divide pens into two groups and compare largest pen from each group with largest top.
Repeat the process with the group containing the largest pen until only one pen is left.
The remaining pen is the largest pen.
Total number of comparisons required is 2n-3.
Q29. How do you find out if a number is a power of 2? And how do you know if it is an odd number? Write code in the language of your choice
Check if a number is a power of 2 and odd.
To check if a number is a power of 2, use bitwise AND operator with the number and its predecessor. If the result is 0, it is a power of 2.
To check if a number is odd, use modulus operator with 2. If the result is 1, it is odd.
Example code in Python:
def is_power_of_two(num):
return num & (num - 1) == 0
def is_odd(num):
return num % 2 == 1
Q30. Given a source array of integers with possible duplicates and a target integer, write algorithm to find out 2 numbers in source array whose sum is equal to target integer
Algorithm to find 2 numbers in an array whose sum is equal to a target integer
Use a hash table to store the difference between target and each element in the array
Iterate through the array and check if the current element exists in the hash table
Return the pair of elements that sum up to the target integer
Q31. Given n dice, each of 'a' sides and a sum b, return the number of ways in which the sum b can be obtained. How can you reduce the time complexity and space complexity?
Given n dice with 'a' sides and sum b, return no. of ways to obtain b. Optimize time and space complexity.
Use dynamic programming to reduce time complexity
Create a 2D array to store the number of ways to obtain each sum for each number of dice
Use rolling arrays to optimize space complexity
Example: n=2, a=6, b=7 -> 6 ways to obtain sum 7
Example: n=3, a=4, b=8 -> 21 ways to obtain sum 8
Q32. Which is faster: finding an item in a hashtable or in a sorted list? And Why?
Hashtable is faster for finding an item than a sorted list.
Hashtable has constant time complexity O(1) for finding an item.
Sorted list has logarithmic time complexity O(log n) for finding an item.
Hashtable uses hashing to directly access the item's location.
Sorted list requires binary search to find the item's location.
Hashtable is ideal for large datasets with frequent lookups.
Sorted list is ideal for datasets that require frequent insertions and deletions.
Q33. Given 2 machines, each having 64 GB RAM, containing all integers (8 byte), sort the entire 128 GB data. You may assume a small amount of additional RAM. Extend this to sort data stored in 1000 machines
Sort 128 GB data on 2 machines with 64 GB RAM each. Extend to 1000 machines.
Use external sorting algorithm like merge sort or quick sort
Divide data into smaller chunks and sort them individually
Merge sorted chunks using additional RAM
For 1000 machines, use distributed sorting algorithms like MapReduce or Hadoop
Ensure data consistency and fault tolerance in distributed sorting
Q34. In google adwords there are about 30 million ads from 42 lanuages . What will I do review the ads and reject ads that do not comply with specific rules
Reviewing 30 million ads from 42 languages in Google AdWords and rejecting non-compliant ads requires a systematic approach.
Create a set of specific rules and guidelines for ad compliance
Use automated tools to filter out ads that violate the rules
Assign a team of reviewers to manually check the remaining ads
Ensure that the reviewers are fluent in the languages of the ads they are reviewing
Regularly update the rules and guidelines to keep up with changes in the industry
Provide...read more
Q35. How would you change the format of all the phone numbers in 1000 static html pages?
Use a script to iterate through each HTML page, locate phone numbers, and update their format.
Write a script using a programming language like Python or JavaScript to iterate through each HTML page
Use regular expressions to locate phone numbers in the pages
Update the format of the phone numbers as needed (e.g. adding country code, changing separators)
Save the updated HTML pages with the new phone number format
Q36. What are some of the most popular Data interchange formats when using APIs
JSON and XML are the most popular data interchange formats when using APIs.
JSON (JavaScript Object Notation) is a lightweight format that is easy to read and write. It is widely used in web APIs.
XML (Extensible Markup Language) is a more complex format that is also widely used in web APIs.
Other formats include CSV (Comma Separated Values), YAML (YAML Ain't Markup Language), and Protocol Buffers.
Q37. Tell about ur strength? Tell about long term goal?
My strength lies in my problem-solving skills and ability to work well in a team. My long term goal is to become a lead developer and contribute to innovative projects.
Strong problem-solving skills
Effective team player
Long term goal of becoming a lead developer
Contribute to innovative projects
Q38. How will improve the revenue of the cafeteria of the office.
By introducing new menu items, optimizing pricing strategy, and improving the overall dining experience.
Conduct a survey to understand the preferences of employees
Introduce healthy and affordable meal options
Offer discounts for bulk orders or loyalty programs
Partner with local vendors to source fresh ingredients
Improve the ambiance and seating arrangements
Implement online ordering and delivery services
Q39. Which data structure will be better suited chain type data.
Linked List is the best-suited data structure for chain type data.
Linked List is a dynamic data structure that can grow or shrink during runtime.
It allows efficient insertion and deletion operations.
Each node in the linked list contains a reference to the next node.
Examples of chain type data include a list of songs in a playlist or a list of tasks in a to-do list.
Q40. Name some popular APIs for each of these Social Commerce service(llike a photo service etc)
Popular APIs for Social Commerce services
Facebook Graph API for social media integration
Instagram API for photo sharing and tagging
Twitter API for real-time updates and customer engagement
Pinterest API for product discovery and sharing
Google Maps API for location-based services
PayPal API for secure payment processing
Q41. Why is Java a platform independent language?
Java is platform independent due to its bytecode and JVM implementation.
Java code is compiled into bytecode, which can run on any platform with a Java Virtual Machine (JVM)
JVM acts as an interpreter, translating bytecode into machine code specific to the underlying platform
This allows Java programs to be written once and run anywhere, without the need for recompilation
Q42. What are Static Binding and Dynamic Binding?
Static binding is resolved at compile time, while dynamic binding is resolved at runtime.
Static binding is also known as early binding, where the method call is resolved at compile time based on the type of the object.
Dynamic binding is also known as late binding, where the method call is resolved at runtime based on the actual type of the object.
Example of static binding: method overloading.
Example of dynamic binding: method overriding.
Q43. input: { type: file, filename: in.txt } mode: strict output: { type: service, server: { hostname: myserver.com } person: { age: 12 } } How would you represent data of this kind in memory ?
The data can be represented in memory using a combination of data structures like objects and arrays.
Use objects to represent the input, output, server, and person data
Use arrays to store multiple values like filenames or hostnames
Use key-value pairs to store specific information like age or type
Q44. What is the lambda expression in JAVA?
Lambda expression in JAVA is a concise way to represent a method implementation using a functional interface.
Lambda expressions are used to provide a more concise way to implement functional interfaces in JAVA.
They are similar to anonymous classes but with less boilerplate code.
Lambda expressions can be used to pass behavior as an argument to a method.
Syntax: (parameters) -> expression or (parameters) -> { statements; }
Example: (int a, int b) -> a + b
Q45. Is the initial shortlisting conducted through an Applicant Tracking System (ATS)?
Yes, many companies use Applicant Tracking Systems for initial shortlisting.
Many companies use ATS to manage and filter large volumes of applications
ATS can automatically screen resumes based on keywords and qualifications
Some examples of popular ATS include Greenhouse, Lever, and Workday
Q46. What type program language do you know?
I am proficient in programming languages such as Java, Python, C++, and JavaScript.
Java
Python
C++
JavaScript
Q47. For i in pythonlife: If i=='l': Break Print(I)
The code will iterate over the characters in 'pythonlife' and print each character until it reaches 'l', then it will stop.
The code uses a for loop to iterate over each character in the string 'pythonlife'.
When the character 'l' is encountered, the loop will break and stop iterating.
The loop will print each character until 'l' is reached, so the output will be 'python'.
Q48. Given a configuration stream, parse it in your data structure. interface Tokenizer { bool hasNext(); string nextToken(); }
Implement a tokenizer interface to parse a configuration stream into a data structure.
Create a class that implements the Tokenizer interface
Use the hasNext method to check if there are more tokens to parse
Use the nextToken method to retrieve the next token from the stream
Store the tokens in a data structure such as a list or map
Q49. Explain Virtual Machine (JVM) architecture.
JVM is a virtual machine that enables a computer to run Java programs.
JVM is platform-independent and converts Java bytecode into machine code.
It consists of class loader, runtime data areas, execution engine, and native method interface.
JVM manages memory, garbage collection, and exception handling.
Examples of JVM implementations include Oracle HotSpot, OpenJ9, and GraalVM.
Q50. For i in range (0,9): Print(i)
The code will print numbers from 0 to 8 in separate lines.
The 'range' function generates a sequence of numbers from 0 to 8 (9 is exclusive).
The 'for' loop iterates through each number in the sequence and prints it.
Q51. Return the 4th largest data, can be solved using heap data structure
Use a heap data structure to find the 4th largest data in an array.
Create a max heap from the array
Pop the top element from the heap 3 times to get the 4th largest element
Return the 4th largest element
Q52. Different cases used for software testing
Different cases used for software testing include functional, performance, security, usability, and compatibility testing.
Functional testing ensures that the software meets the specified requirements
Performance testing checks the software's speed, scalability, and stability under different loads
Security testing identifies vulnerabilities and ensures data protection
Usability testing evaluates the software's user-friendliness
Compatibility testing checks the software's compatibi...read more
Q53. why is google better than facebook?
Google is better than Facebook due to its focus on search and information retrieval.
Google's primary focus is on search and information retrieval, while Facebook is more focused on social networking.
Google's search algorithm is more advanced and accurate compared to Facebook's search functionality.
Google offers a wide range of services beyond social networking, such as Google Maps, Gmail, and Google Drive.
Google has a larger market share and is considered the go-to search eng...read more
Q54. what is dsa and what is advantages
DSA stands for Data Structures and Algorithms. It is essential for efficient problem-solving in software development.
DSA helps in organizing and managing data effectively
It improves the efficiency and performance of algorithms
Common data structures include arrays, linked lists, trees, graphs
Common algorithms include sorting, searching, and dynamic programming
Q55. Remove unnecessary spaces in the given string.
Remove unnecessary spaces in a given string.
Use the trim() method to remove leading and trailing spaces.
Use replace() method with regex to remove multiple spaces between words.
Example: ' Hello World ' -> 'Hello World'
Q56. Optimize a^b and write an appropriate program
Optimize a^b calculation using bitwise operations
Use bitwise operations like left shift and AND to optimize exponentiation
Avoid using traditional multiplication for each iteration
Example: Optimized power function in C++ - int power(int a, int b) { int result = 1; while (b > 0) { if (b & 1) result *= a; a *= a; b >>= 1; } return result; }
Q57. Explain types of inheritances?
Types of inheritances include single, multiple, multilevel, hierarchical, hybrid, and multipath.
Single inheritance: a class inherits from only one base class.
Multiple inheritance: a class inherits from more than one base class.
Multilevel inheritance: a class inherits from a class which in turn inherits from another class.
Hierarchical inheritance: multiple classes inherit from a single base class.
Hybrid inheritance: combination of multiple and multilevel inheritance.
Multipath ...read more
Q58. Write program for break program?
A program that breaks another program into smaller parts or components.
Use functions or modules to break down the main program into smaller, more manageable parts
Consider using object-oriented programming principles to encapsulate related functionality
Utilize comments and documentation to explain the purpose and functionality of each part
Q59. what is windows functions in sql
Windows functions in SQL are built-in functions that perform calculations across a set of rows and return a single value.
Windows functions are used to perform calculations on a specific subset of rows in a result set.
They are often used with the OVER clause to define the window of rows over which the function operates.
Examples of windows functions include ROW_NUMBER(), RANK(), and SUM().
Q60. How do you split search query
Splitting search query involves breaking it down into individual keywords or phrases for more accurate results.
Identify key words or phrases in the search query
Use delimiters like spaces or commas to separate the query into individual components
Consider using regular expressions for more complex splitting requirements
Q61. What is ur goal?
My goal is to continuously improve my technical skills, contribute to innovative projects, and advance in my career as a software developer.
Continuous learning and improvement in technical skills
Contributing to innovative projects
Advancing in my career as a software developer
Q62. Given a tree, find top k nodes with highest value
Use a priority queue to find top k nodes with highest value in a tree
Traverse the tree and store nodes in a priority queue based on their values
Pop k nodes from the priority queue to get the top k nodes with highest value
Q63. Write program for for loop?
A for loop is used to iterate over a sequence of elements for a specified number of times.
Initialize a counter variable before the loop
Set the condition for the loop to continue based on the counter variable
Update the counter variable after each iteration
Example: for(int i = 0; i < 5; i++) { // code block }
Q64. c++ is bad that java why?
C++ and Java have different strengths and weaknesses, it's not accurate to say one is 'bad' compared to the other.
C++ is closer to the hardware and allows for more low-level programming, while Java is more platform-independent and easier to learn.
C++ gives more control over memory management, but this can lead to more bugs if not handled properly.
Java has automatic garbage collection, making memory management easier for developers.
C++ is often used for system programming and ...read more
Q65. what is cpp and its use case
C++ is a programming language used for developing software applications.
C++ is a high-level programming language known for its performance and flexibility.
It is commonly used for developing system software, game engines, and applications that require high performance.
C++ supports object-oriented programming, generic programming, and low-level memory manipulation.
Examples of software developed using C++ include operating systems like Windows, game engines like Unreal Engine, a...read more
Q66. what is java and its use case
Java is a popular programming language used for developing a wide range of applications.
Java is platform-independent, meaning it can run on any device with a Java Virtual Machine (JVM)
It is used for developing web applications, mobile apps, desktop applications, and enterprise software
Java is known for its security features and scalability
Examples of Java-based applications include Android apps, online banking systems, and e-commerce websites
Q67. What is main goal?
The main goal of a Software Developer is to design, develop, and maintain software applications to meet the needs of users.
Designing software applications based on user requirements
Developing code to implement the design
Testing and debugging software to ensure functionality
Maintaining and updating software as needed
Collaborating with team members to achieve project goals
Q68. Average of each subtree on a node in N-arry tree
Calculate the average of each subtree on a node in an N-arry tree.
Traverse the tree using depth-first search (DFS)
Maintain a sum and count for each subtree while traversing
Calculate the average by dividing the sum by the count for each subtree
Q69. How long do you code daily ?
I typically code for 6-8 hours daily, with breaks in between for rest and refreshment.
I code for 6-8 hours daily to ensure productivity and progress on projects.
I take breaks in between coding sessions to rest my mind and prevent burnout.
I prioritize quality over quantity, focusing on writing clean and efficient code.
I enjoy coding and often spend extra time outside of work hours on personal projects or learning new technologies.
Q70. Palindrome of the number we have to return
Return the palindrome of a given number
Check if the number is equal to its reverse to determine if it is a palindrome
Convert the number to a string to easily reverse it
Handle negative numbers by converting them to positive before checking for palindrome
Q71. experinces and how you perform
I have over 5 years of experience in software development, with a strong focus on web applications and database management.
Developed web applications using HTML, CSS, JavaScript, and various frameworks like Angular and React
Proficient in database management with SQL and NoSQL databases such as MySQL and MongoDB
Experience in version control systems like Git for collaborative development
Strong problem-solving skills and ability to work in a team environment
Continuously learning...read more
Q72. Find median of stream of integer numbers
Use two heaps to keep track of the numbers and find median efficiently.
Use a max heap to store the smaller half of the numbers and a min heap to store the larger half.
Keep the size of the two heaps balanced or with a difference of at most 1.
If the total number of elements is odd, the median is the top element of the larger heap. If even, it's the average of the tops of both heaps.
Q73. Difference between MySQL and SQLite.
MySQL is a full-featured relational database management system, while SQLite is a lightweight, serverless, self-contained database engine.
MySQL is designed for larger applications with client-server architecture, while SQLite is suitable for smaller projects or embedded systems.
MySQL supports multiple users and concurrent connections, while SQLite is limited to single-user access.
MySQL has more advanced features like stored procedures, triggers, and views, while SQLite is sim...read more
Q74. Sort an array without inbuilt methods
Sorting an array of strings without using inbuilt methods
Use a sorting algorithm like bubble sort, selection sort, or insertion sort
Compare each element with the next one and swap if necessary
Repeat the process until the array is sorted
Q75. What is the javascript
JavaScript is a programming language used for creating interactive web pages and web applications.
JavaScript is a high-level, interpreted language.
It is primarily used for client-side scripting.
JavaScript can be embedded directly into HTML pages.
It provides dynamic functionality and interactivity to websites.
Common uses include form validation, DOM manipulation, and AJAX requests.
Q76. What is interfaces in java
Interfaces in Java are a way to achieve abstraction and multiple inheritance by defining a contract that classes must implement.
Interfaces in Java are similar to classes but can only contain method signatures and constants, not method implementations.
Classes can implement multiple interfaces, allowing them to inherit behavior from multiple sources.
Interfaces are used to achieve abstraction and decouple the implementation from the interface, promoting flexibility and reusabili...read more
Q77. How I will reallocate
I will reallocate resources based on project priorities and team needs.
Prioritize tasks based on project deadlines and importance
Communicate with team members to understand their workload and availability
Adjust resources as needed to ensure project success
Example: If a critical project is falling behind schedule, I may reallocate resources from less urgent projects to meet the deadline
Q78. what is linked list
A linked list is a linear data structure where elements are stored in nodes that have a reference to the next node in the sequence.
Consists of nodes connected by pointers
Does not have a fixed size like arrays
Allows for efficient insertion and deletion operations
Example: Singly linked list, Doubly linked list
Q79. multi source bfs on the array
Multi-source BFS on an array of strings involves finding the shortest path from multiple starting points to a target point.
Implement BFS algorithm to traverse the array of strings starting from multiple sources simultaneously.
Maintain a queue of nodes to visit next, and keep track of visited nodes to avoid revisiting.
Update the distance of each node from the sources as you traverse the array.
Example: Given an array of strings representing a grid, find the shortest path from m...read more
Q80. coding program and complexity
Coding programs can vary in complexity depending on the requirements and functionalities needed.
Complexity can be measured using Big O notation, which describes the worst-case scenario for time and space complexity.
Factors affecting complexity include data structures used, algorithms implemented, and the size of input data.
Examples of complex programs include machine learning algorithms, large-scale distributed systems, and real-time processing applications.
Q81. Subarray finding maximum
Find the maximum sum of a subarray within an array of strings.
Iterate through the array and keep track of the maximum sum of subarrays.
Use Kadane's algorithm to efficiently find the maximum sum subarray.
Example: ['1', '2', '-3', '4', '5', '-6'] -> Maximum sum subarray is ['4', '5'].
Q82. binary search on array
Binary search is a fast search algorithm that finds the position of a target value within a sorted array.
Ensure the array is sorted before performing binary search.
Compare the target value with the middle element of the array.
If the target value is less than the middle element, search the left half of the array. If it is greater, search the right half.
Repeat the process until the target value is found or the subarray is empty.
Q83. HASHMAP ,find the all buddy
A HashMap is a data structure that stores key-value pairs. To find all buddies in a HashMap, we need to iterate through the entries and compare values.
Iterate through the entries of the HashMap
Compare values to find buddies
Store buddies in an array of strings
Q84. Trees based on meduim problem
Trees are data structures used to store hierarchical data. They are commonly used in algorithms and problem-solving.
Trees have a root node and branches that connect to other nodes.
Common tree traversal methods include in-order, pre-order, and post-order.
Examples of tree-based problems include finding the lowest common ancestor, balancing a binary search tree, and implementing a trie data structure.
Q85. develop Snake game
Develop a classic Snake game using JavaScript and HTML5 canvas.
Use HTML5 canvas to draw the game board and snake.
Implement logic for snake movement and collision detection.
Add functionality for snake to grow when eating food.
Track score and display it on the screen.
Handle game over condition when snake collides with walls or itself.
More about working at Google
Interview Process at KESCo
Reviews
Interviews
Salaries
Users/Month