Nagarro
10+ Tripjack Interview Questions and Answers
Q1. N-th Term Of Geometric Progression
Find the N-th term of a Geometric Progression (GP) series given the first term A, the common ratio R, and the term position N.
Explanation:
The general form of a GP series is ...read more
Calculate the N-th term of a Geometric Progression series given the first term, common ratio, and term position.
Iterate through each test case and apply the formula A * R^(N-1) to find the N-th term
Use modular arithmetic to handle large calculated terms by returning the result modulo 10^9 + 7
Q2. Remove String from Linked List Problem
You are provided with a singly linked list where each node contains a single character, along with a string 'STR'. Your task is to remove all occurrences of the string 'ST...read more
Remove all occurrences of a given string from a singly linked list by starting from the end of the list.
Traverse the linked list from the end to the beginning to efficiently remove the string occurrences.
Check for the string 'STR' in each node and remove it if found.
Continue checking for new occurrences of 'STR' after removal to ensure all instances are removed.
Return the head of the modified linked list after processing each test case.
Q3. 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
Find the length of the longest strictly increasing subsequence in an array of integers.
Use dynamic programming to keep track of the length of the longest increasing subsequence ending at each element.
Iterate through the array and update the length of the longest increasing subsequence for each element.
Return the maximum length found in the dynamic programming array as the result.
Q4. one code to solve find frequency of every character of string
A code to find the frequency of every character in a string.
Create an empty dictionary to store the frequency of each character.
Iterate through the string and for each character, check if it is already in the dictionary.
If it is, increment its value by 1. If it is not, add it to the dictionary with a value of 1.
Return the dictionary with the frequency of each character.
Q5. Find missing number in array of n size where numbers are from 1 to n
Use the formula for sum of first n natural numbers to find the missing number in the array.
Calculate the sum of first n natural numbers using the formula n*(n+1)/2
Calculate the sum of all numbers in the array
Subtract the sum of array from the sum of first n natural numbers to find the missing number
Q6. SQL Commands,difference between Delete and truncate.
Delete and truncate are SQL commands used to remove data from a table, but they differ in their functionality.
DELETE command is used to remove specific rows from a table based on a condition
TRUNCATE command is used to remove all the rows from a table
DELETE command can be rolled back, while TRUNCATE command cannot be rolled back
DELETE command is slower than TRUNCATE command
DELETE command can be used with or without a WHERE clause, while TRUNCATE command cannot be used with a W...read more
Q7. find middle element in linked list and Floyd algorithm.
Finding middle element in linked list using Floyd algorithm.
Floyd algorithm uses two pointers, one slow and one fast, to traverse the linked list.
The slow pointer moves one node at a time while the fast pointer moves two nodes at a time.
When the fast pointer reaches the end of the list, the slow pointer will be at the middle element.
If the list has even number of elements, there will be two middle elements.
In that case, we can return either of the two middle elements.
Q8. 1.Move all zeroes to the end ,2. Count frequency of characters in string
The question involves two tasks: moving all zeroes to the end of an array and counting the frequency of characters in a string.
To move all zeroes to the end of an array, iterate through the array and keep track of the non-zero elements. Then, fill the remaining positions with zeroes.
To count the frequency of characters in a string, iterate through the string and use a dictionary or array to store the count of each character.
Q9. Swap two no without third variable
To swap two numbers without using a third variable, use arithmetic operations.
Use addition and subtraction to swap the numbers. For example, a=5, b=10. a=a+b, b=a-b, a=a-b will swap the values.
Another method is to use XOR operation. For example, a=5, b=10. a=a^b, b=a^b, a=a^b will swap the values.
Q10. how to achieve abstraction
Abstraction can be achieved by hiding unnecessary details and only exposing essential features.
Identify the essential features of the system
Hide unnecessary details by encapsulating them
Use interfaces to define essential features
Implement the interfaces to provide functionality
Example: A car's interface is the steering wheel, pedals, and dashboard. The engine and transmission are encapsulated.
Example: A software interface is a public method that exposes functionality while hi...read more
Q11. Real life application of data structures
Data structures like arrays and linked lists are used in real life applications such as social media networks, databases, and GPS systems.
Social media networks use arrays to store user profiles and linked lists to manage friend connections.
Databases use data structures like B-trees and hash tables to efficiently store and retrieve data.
GPS systems use graphs to represent road networks and find the shortest path between locations.
Q12. Explain one algo ,OOPS concept
OOPS concept - Inheritance
Inheritance is a mechanism in OOPS where a new class is derived from an existing class
The new class inherits all the properties and behavior of the existing class
It allows code reusability and helps in creating a hierarchy of classes
Example: A class 'Car' can be inherited by a class 'SUV' which will have all the properties of 'Car' and additional properties specific to 'SUV'
Inheritance can be of different types - single, multiple, multilevel, hierarc...read more
Q13. Latest technologies right now
Some of the latest technologies right now include artificial intelligence, machine learning, blockchain, Internet of Things (IoT), and 5G.
Artificial intelligence (AI) - used in various industries for automation and decision-making
Machine learning - subset of AI that enables systems to learn and improve from experience
Blockchain - decentralized and secure way of storing and sharing data
Internet of Things (IoT) - network of interconnected devices that can communicate and share ...read more
Q14. Reverse The Linked list
Reverse a linked list by changing the direction of pointers
Start from the head of the linked list
Iterate through the list and change the direction of pointers to reverse the list
Update the head to point to the last node as the new head
Q15. quicksort algorithm
Quicksort is a sorting algorithm that uses divide and conquer approach to sort an array.
It selects a pivot element and partitions the array around the pivot.
It recursively sorts the sub-arrays created by partitioning.
It has an average time complexity of O(nlogn) and worst case time complexity of O(n^2).
More about working at Nagarro
Top HR Questions asked in Tripjack
Interview Process at Tripjack
Top Associate Software Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month