Wissen Technology
20+ Nykaa Interview Questions and Answers
Q1. Write a javascript function which returns maximum and minimum occurrence of letter from string
A javascript function to find the maximum and minimum occurrence of a letter in a string.
Create an object to store the count of each letter in the string
Loop through the string and update the count in the object
Find the maximum and minimum count in the object and return the corresponding letters
Q2. Give a list of cards, sort on the basis of their rank and suit.
Sort a list of cards based on their rank and suit.
Create a custom sorting function that first sorts by rank and then by suit
Use a comparison function to compare ranks and suits of each card
Example: ['2H', '3D', '10S', 'AH', '4C'] should be sorted as ['2H', '3D', '4C', '10S', 'AH']
Q3. write a program to merge 2 sorted list with n+m complexity
Merge two sorted lists with n+m complexity
Create a new list to store the merged result
Iterate through both lists simultaneously and compare elements
Add the smaller element to the new list and move to the next element in that list
Continue until all elements from both lists are merged
Q4. 1. Write a program to split array on given split size.
A program to split an array of strings into smaller arrays based on a given split size.
Iterate through the array and create a new subarray every split size elements
Use array slicing or a loop to extract the subarrays
Handle cases where the split size is larger than the array length
Q5. 2. Write a program to flatten multi dimension Object[] array to Integer[]
Program to flatten multi dimension Object[] array to Integer[]
Use recursion to iterate through the array and flatten each element
Check if each element is an array or an integer
If it's an array, recursively flatten it
If it's an integer, add it to the result array
Q6. Group by in java stream based on 2 fields
Group by in Java stream based on 2 fields can be achieved using Collectors.groupingBy with a composite key
Use Collectors.groupingBy with a composite key to group by multiple fields
Create a class to represent the composite key if necessary
Example: Map
>> groupedData = dataList.stream().collect(Collectors.groupingBy(obj -> obj.getField1() + obj.getField2()))
Q7. Create a project to maintain shopping list
A project to maintain shopping list
Create a class or data structure to store items in the shopping list
Implement functions to add, remove, and update items in the list
Include functionality to mark items as purchased
Allow users to view the entire list or filter by category
Consider adding a feature to set reminders for shopping trips
Q8. design pattern to track count of hashmap inserts
Use Observer design pattern to track count of hashmap inserts
Implement an Observer interface with update method to track changes in the hashmap
Create a concrete observer class to keep track of the count of inserts
Register the observer with the hashmap to receive notifications on inserts
Q9. Static Constructor overloaded or not?
Static constructor can be overloaded in C#.
Static constructor is used to initialize static fields of a class.
Overloading static constructor is useful when we want to initialize different static fields with different values.
Static constructor is called only once, before the first instance of the class is created.
Static constructor has no access modifier and no parameters.
Q10. Stream vs parallel stream of java
Stream is sequential processing while parallel stream allows for concurrent processing in Java.
Stream is processed sequentially while parallel stream is processed concurrently.
Parallel stream can improve performance for large datasets by utilizing multiple threads.
Use parallel stream when order of processing is not important.
Example: List
list = Arrays.asList("a", "b", "c"); list.stream().forEach(System.out::println); Example: List
list = Arrays.asList("a", "b", "c"); list.par...read more
Q11. Different between Thread and Task?
Thread is a lightweight process that runs concurrently with other threads in a process. A task is a unit of work that can be executed asynchronously.
Threads are managed by the operating system, while tasks are managed by a task scheduler.
Threads are more low-level and require more manual management, while tasks are higher-level and can be managed more easily.
Threads are typically used for parallelism, while tasks are used for asynchronous programming.
Examples of threading lib...read more
Q12. what is dependency injection
Dependency injection is a design pattern where components are given their dependencies rather than creating them internally.
Dependency injection helps in achieving loose coupling between classes.
It allows for easier testing by providing a way to mock dependencies.
There are three types of dependency injection - constructor injection, setter injection, and interface injection.
Q13. Difference between call, apply and bind
Call, apply, and bind are methods in JavaScript used to set the context of a function and pass arguments.
Call - invokes a function with a specified 'this' value and arguments provided individually.
Apply - invokes a function with a specified 'this' value and arguments provided as an array.
Bind - creates a new function that, when called, has its 'this' keyword set to the provided value.
Q14. Java8 features in details
Java8 introduced several new features including lambda expressions, functional interfaces, streams, and default methods.
Lambda expressions allow for more concise code by enabling functional programming.
Functional interfaces are interfaces with a single abstract method, which can be implemented using lambda expressions.
Streams provide a way to work with collections of objects in a functional style, allowing for parallel processing and lazy evaluation.
Default methods allow inte...read more
Q15. n+1 problem of hibernate
The n+1 problem in Hibernate occurs when a query results in multiple individual queries being executed for each row fetched.
Occurs when a query fetches a collection and then for each element in the collection, another query is executed to fetch related data
Can be resolved by using fetch joins or batch fetching to reduce the number of queries
Improves performance by reducing the number of database round trips
Q16. design immutable class
Immutable class is a class whose state cannot be modified after creation.
Make all fields private and final
Do not provide setter methods
Ensure deep copy of mutable objects in constructor and getter methods
Q17. Core java and dsa algorithm
Core Java is a fundamental programming language used for developing software applications. DSA algorithms are essential for efficient problem-solving.
Core Java is used for developing software applications and is based on the Java programming language.
DSA algorithms are data structures and algorithms used for efficient problem-solving.
Examples of DSA algorithms include sorting algorithms like Bubble Sort and searching algorithms like Binary Search.
Q18. Dsa problems and system design
DSA problems involve solving algorithmic challenges, while system design involves designing scalable and efficient software systems.
Practice solving DSA problems on platforms like LeetCode, HackerRank, or CodeSignal.
Study common data structures and algorithms like arrays, linked lists, trees, sorting algorithms, and searching algorithms.
For system design, focus on scalability, reliability, performance, and maintainability of software systems.
Learn about designing distributed ...read more
Q19. internal of hashmap
Internal implementation of hashmap involves an array of linked lists to handle collisions.
HashMap internally uses an array of linked lists to store key-value pairs.
When a key is inserted, its hash code is used to determine the index in the array where it should be stored.
If two keys have the same hash code, they are stored in the same linked list to handle collisions.
HashMap uses the key's hash code and equals method to find and retrieve values efficiently.
Q20. max sum of subarray
Find the maximum sum of a contiguous subarray within an array of integers.
Use Kadane's algorithm to find the maximum sum subarray efficiently.
Iterate through the array and keep track of the maximum sum ending at each index.
Reset the sum to 0 if it becomes negative, as a negative sum will never contribute to the maximum sum.
Interview Process at Nykaa
Top Senior Software Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month