Nagarro
Still I Rise Interview Questions and Answers
Q1. How can you check whether the give string can become palindrome or not. You can apply unlimited operations.
To check if a string can become a palindrome, count the frequency of each character. If there is at most one character with an odd frequency, it can be rearranged into a palindrome.
Count the frequency of each character in the string
Check if there is at most one character with an odd frequency
If yes, the string can be rearranged into a palindrome
Q2. Given an array find if there are two elements are present that sum to target, else return -1;
Given an array find if there are two elements are present that sum to target, else return -1
Iterate through the array and for each element check if target - element is present in the array
Use a hash table to store the elements and their indices for faster lookup
If no such pair is found, return -1
Q3. In what cases quick sort has worst case time complexity
Quick sort has worst case time complexity when the pivot element is either the smallest or largest element in the array.
Pivot element is the smallest or largest element in the array
Array is already sorted in ascending or descending order
Pivot selection strategy is not efficient
Q4. How can you find middle element of linkedList in O(n)
Use two pointers, one moving twice as fast as the other, to find the middle element of a linked list in O(n) time complexity.
Initialize two pointers, slow and fast, at the head of the linked list.
Move the slow pointer one step at a time and the fast pointer two steps at a time.
When the fast pointer reaches the end of the list, the slow pointer will be at the middle element.
Q5. Real life usage of data strctures.
Data structures are used in real life for organizing and managing data efficiently.
Storing and retrieving contact information in a phone book using a hash table
Organizing and searching for books in a library using a binary search tree
Managing a playlist of songs using a linked list
Q6. Reverse the linkedlist
Reverse a linked list
Iterate through the linked list and change the direction of the pointers
Use three pointers to keep track of the current, previous and next nodes
Recursively reverse the linked list
More about working at Nagarro
Top HR Questions asked in Still I Rise
Interview Process at Still I Rise
Top Trainee Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month