Intuit
40+ Accenture Interview Questions and Answers
Q1. Word Presence in Sentence
Determine if a given word 'W' is present in the sentence 'S' as a complete word. The word should not merely be a substring of another word.
Input:
The first line contains an integer 'T...read more
Check if a given word is present in a sentence as a complete word.
Split the sentence into words using spaces as delimiter.
Check if the given word matches any of the words in the sentence.
Ensure the word is not just a substring of another word in the sentence.
Q2. Closest Distance Pair Problem Statement
Given an array containing 'N' points in a 2D plane, determine the minimum distance between the closest pair of points.
Note:
Distance between two points (x1, y1) and (x2,...read more
The problem involves finding the minimum distance between the closest pair of points in a 2D plane.
Iterate through all pairs of points and calculate the distance between them using the given formula.
Keep track of the minimum distance found so far.
Optimize the solution by using techniques like sorting the points based on x or y coordinates.
Q3. Detect the First Node of the Loop in a Singly Linked List
You are provided with a singly linked list that may contain a cycle. Your task is to return the node where the cycle begins, if such a cycle exists.
A c...read more
To detect the first node of a loop in a singly linked list, we can use Floyd's Cycle Detection Algorithm.
Use Floyd's Cycle Detection Algorithm to detect the cycle in the linked list.
Once the cycle is detected, find the starting node of the cycle using two pointers approach.
The first pointer moves one step at a time while the second pointer moves two steps at a time until they meet at the starting node of the cycle.
Q4. Reverse Linked List Problem Statement
Given a singly linked list of integers, return the head of the reversed linked list.
Example:
Initial linked list: 1 -> 2 -> 3 -> 4 -> NULL
Reversed linked list: 4 -> 3 -> 2...read more
Reverse a singly linked list of integers and return the head of the reversed linked list.
Iterate through the linked list and reverse 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 linked list.
Update the head of the reversed linked list as the last node encountered during the reversal process.
Q5. Greatest Common Divisor Problem Statement
You are tasked with finding the greatest common divisor (GCD) of two given numbers 'X' and 'Y'. The GCD is defined as the largest integer that divides both of the given...read more
Find the greatest common divisor (GCD) of two given numbers 'X' and 'Y'.
Implement a function to calculate GCD using Euclidean algorithm
Iteratively find the remainder of X divided by Y until Y becomes 0
The last non-zero remainder is the GCD of X and Y
Q6. Count Pairs with Given Sum
Given an integer array/list arr
and an integer 'Sum', determine the total number of unique pairs in the array whose elements sum up to the given 'Sum'.
Input:
The first line contains ...read more
Count the total number of unique pairs in an array whose elements sum up to a given value.
Iterate through the array and for each element, check if the complement (Sum - current element) exists in a hash set.
If the complement exists, increment the count of pairs and remove the complement from the set to avoid duplicates.
Return the total count of pairs at the end.
Q7. N Queens Problem
Given an integer N
, find all possible placements of N
queens on an N x N
chessboard such that no two queens threaten each other.
Explanation:
A queen can attack another queen if they are in the...read more
The N Queens Problem involves finding all possible placements of N queens on an N x N chessboard without threatening each other.
Use backtracking algorithm to explore all possible configurations.
Keep track of rows, columns, and diagonals to ensure queens do not threaten each other.
Generate all valid configurations and print them out.
Q8. 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
Sort an array of 0s, 1s, and 2s in linear time complexity using a single scan.
Use three pointers to keep track of the positions of 0s, 1s, and 2s in the array.
Iterate through the array and swap elements based on their values and the pointers.
After a single scan, the array will be sorted in-place with 0s, 1s, and 2s in order.
Q9. Inorder Successor in a Binary Tree
Find the inorder successor of a given node in a binary tree. The inorder successor is the node that appears immediately after the given node during an inorder traversal. If th...read more
Find the inorder successor of a given node in a binary tree.
Perform an inorder traversal of the binary tree to find the successor node
If the given node has a right child, the successor is the leftmost node in the right subtree
If the given node does not have a right child, backtrack to find the ancestor whose left child is the given node
Q10. Add Two Numbers as Linked Lists
You are given two singly linked lists, where each list represents a positive number without any leading zeros.
Your task is to add these two numbers and return the sum as a linke...read more
Add two numbers represented as linked lists and return the sum as a linked list.
Traverse both linked lists simultaneously while keeping track of carry from previous sum
Handle cases where one linked list is longer than the other by padding with zeros
Create a new linked list to store the sum of the two numbers
Q11. Stack with getMin Operation
Create a stack data structure that supports not only the usual push and pop operations but also getMin(), which retrieves the minimum element, all in O(1) time complexity without usi...read more
Implement a stack with getMin operation in O(1) time complexity without using extra space.
Use two stacks - one to store the actual elements and another to store the minimum values encountered so far.
When pushing an element, check if it is smaller than the current minimum and if so, push it onto the minimum stack.
When popping an element, check if it is the current minimum and if so, pop from the minimum stack as well.
For getMin operation, simply return the top element of the m...read more
Q12. Sort a Stack Problem Statement
You are provided with a stack consisting of 'N' integers. The goal is to sort this stack in descending order by utilizing recursion.
Allowed Stack Operations:
is_empty(S) : Check ...read more
Sort a stack in descending order using recursion without using loop constructs.
Implement a recursive function to sort the stack in descending order.
Use the provided stack operations to manipulate the stack.
Recursively pop elements from the stack, sort them, and push them back in descending order.
Handle base cases such as an empty stack or a single element stack.
Ensure the stack is sorted in descending order after the recursive calls.
Avoid using loop constructs like while or f...read more
Q13. LCA of Binary Tree Problem Statement
You are given a binary tree consisting of distinct integers and two nodes, X
and Y
. Your task is to find and return the Lowest Common Ancestor (LCA) of these two nodes.
The ...read more
Find the Lowest Common Ancestor (LCA) of two nodes in a binary tree.
Traverse the binary tree to find the paths from the root to nodes X and Y.
Compare the paths to find the last common node, which is the LCA.
Handle cases where one node is an ancestor of the other.
Consider edge cases like when X or Y is the root node.
Implement a recursive or iterative solution to find the LCA efficiently.
Q14. Product Of Array Except Self Problem Statement
You are provided with an integer array ARR
of size N
. You need to return an array PRODUCT
such that PRODUCT[i]
equals the product of all the elements of ARR
except...read more
The problem requires returning an array where each element is the product of all elements in the input array except itself.
Iterate through the array twice to calculate the product of all elements to the left and right of each element.
Use two arrays to store the products to the left and right of each element.
Multiply the corresponding elements from the left and right arrays to get the final product array.
Handle integer overflow by taking modulo MOD = 10^9 + 7.
To solve with O(1...read more
Q15. LRU Cache Design Question
Design a data structure for a Least Recently Used (LRU) cache that supports the following operations:
1. get(key)
- Return the value of the key if it exists in the cache; otherwise, re...read more
Design a Least Recently Used (LRU) cache data structure that supports get and put operations with capacity constraint.
Implement a doubly linked list to keep track of the order of keys based on their recent usage.
Use a hashmap to store key-value pairs for quick access and update.
When capacity is reached, evict the least recently used item before inserting a new item.
Update the order of keys in the linked list whenever a key is accessed or updated.
Handle get and put operations ...read more
Q16. Problem Statement: Delete Node In A Linked List
Given a singly linked list of integers and a reference to a node, your task is to delete that specific node from the linked list. Each node in the linked list has...read more
Delete a specific node from a singly linked list given the reference to the node.
Traverse the linked list to find the node to be deleted.
Update the pointers to skip over the node to be deleted.
Print the modified linked list after deletion.
Q17. Insertion Sort in a Linked List
Given a singly linked list with 'N' nodes containing integer values, your task is to sort the list using insertion sort and output the sorted list.
Insertion Sort is an algorithm...read more
Implement insertion sort algorithm on a singly linked list.
Traverse the linked list and for each node, find its correct position in the sorted list.
Keep track of the current node and the previous node to perform the insertion.
Repeat this process until all nodes are sorted in the linked list.
Ensure to handle edge cases like empty list or list with only one node.
Q18. Generate All Parentheses Combinations
Given an integer N
, your task is to create all possible valid parentheses configurations that are well-formed using N
pairs. A sequence of parentheses is considered well-fo...read more
Generate all valid parentheses combinations for N pairs.
Use backtracking to generate all possible combinations of parentheses.
Keep track of the number of open and close parentheses used.
Add '(' if there are remaining open parentheses, and add ')' if there are remaining close parentheses.
Stop when the length of the generated string is 2*N.
Q19. How do you design a website which displays say top 1000 products with product rating updating every second?
To design a website displaying top 1000 products with real-time rating updates, use a combination of backend and frontend technologies.
Implement a backend system to fetch and update product ratings from a database or API.
Use a frontend framework like React or Angular to create a dynamic user interface.
Implement pagination or lazy loading to handle the large number of products.
Optimize the website for performance by caching frequently accessed data.
Consider using websockets or...read more
Q20. Problem: Permutations of a String
Given a string STR
consisting of lowercase English letters, your task is to return all permutations of the given string in lexicographically increasing order.
Explanation:
A st...read more
Return all permutations of a given string in lexicographically increasing order.
Generate all permutations of the given string using backtracking.
Sort the permutations in lexicographical order.
Print the sorted permutations separated by space.
Q21. Minimum Number Of Operations To Reach X Problem Statement
Given an array ARR
of 'N' integers and an integer 'X', determine the minimum number of operations required to make the sum of removed elements from eith...read more
Given an array of integers and a target sum, find the minimum number of operations to make the sum of removed elements equal to the target.
Iterate from both ends of the array, removing elements until the sum matches the target
Use a two-pointer approach to efficiently find the minimum number of operations
If achieving the target sum is not possible, return -1
Q22. Median of Two Sorted Arrays
Given two sorted arrays A
and B
of sizes N
and M
, find the median of the merged array formed by combining arrays A
and B
. If the total number of elements, N + M
, is even, the median ...read more
Find the median of two sorted arrays by merging them and calculating the median of the combined array.
Merge the two sorted arrays into one sorted array.
Calculate the median of the merged array based on the total number of elements.
If the total number of elements is even, take the mean of the two middle elements as the median.
Q23. Find Duplicates in an Array
Given an array ARR
of size 'N', where each integer is in the range from 0 to N - 1, identify all elements that appear more than once.
Return the duplicate elements in any order. If n...read more
Find duplicates in an array of integers within a specified range.
Iterate through the array and keep track of the count of each element using a hashmap.
Return elements with count greater than 1 as duplicates.
Time complexity can be optimized to O(N) using a set to store duplicates.
Design a website to display top 1000 products with real-time ratings.
Utilize a backend server to fetch and update product ratings every second.
Implement a front-end framework like React to display the products and ratings dynamically.
Use a database to store and retrieve product information efficiently.
Consider implementing caching mechanisms to reduce server load.
Optimize the website for performance to handle frequent updates and large data sets.
Q25. Implement a specialStack class which should support O(1) push O(1) pop and should return minimum element in the stack in O(1) time
Implement a specialStack class with O(1) push, pop, and minimum element retrieval.
Use an additional stack to keep track of the minimum element at each step.
When pushing an element, compare it with the top of the minimum stack and update if necessary.
When popping an element, also pop from the minimum stack if the popped element is the current minimum.
Q26. Given an array and a number find a pair of integers in the array whose sum is equal to given number.
Find a pair of integers in an array whose sum is equal to a given number.
Iterate through the array and for each element, check if the difference between the given number and the current element exists in the array.
Use a hash set to store the elements of the array for efficient lookup.
Return the pair of integers if found, otherwise return a message indicating no such pair exists.
To determine the top 3 fastest horses out of 25, race horses in groups of 5 and keep track of the fastest horses in each race.
Divide the 25 horses into 5 groups of 5 horses each.
Race all 5 horses in each group, keeping track of the top 3 fastest horses in each race.
After 5 races, you will have the top 3 fastest horses from each group.
Race the top 3 horses from each group in a final race to determine the overall top 3 fastest horses.
OOP is a programming paradigm based on the concept of objects, which can contain data in the form of fields and code in the form of procedures.
OOP focuses on creating objects that interact with each other to solve problems.
Key concepts include encapsulation, inheritance, and polymorphism.
Encapsulation involves bundling data and methods that operate on the data into a single unit.
Inheritance allows a class to inherit properties and behavior from another class.
Polymorphism allo...read more
Fail-fast iterators throw ConcurrentModificationException if the collection is modified while iterating. Fail-safe iterators do not throw exceptions and operate on a cloned copy of the collection.
Fail-fast iterators throw ConcurrentModificationException if the collection is modified while iterating.
Fail-safe iterators do not throw exceptions and operate on a cloned copy of the collection.
Fail-fast iterators are used in most of the Collection classes like ArrayList, HashMap, e...read more
Different ways to traverse over a map in Java include using keySet(), entrySet(), and forEach() method.
Use keySet() method to iterate over keys in the map
Use entrySet() method to iterate over key-value pairs in the map
Use forEach() method to iterate over key-value pairs in the map
Memory management in operating systems involves allocation, deallocation, and optimization of memory usage.
Memory management is crucial for efficient utilization of system resources.
Operating systems use techniques like paging, segmentation, and virtual memory to manage memory.
Memory management also involves handling memory leaks, fragmentation, and ensuring data integrity.
Examples include malloc() and free() functions in C programming for dynamic memory allocation.
Q32. Find lca of 2 nodes in a binary tree (write pseudocode)
The Lowest Common Ancestor (LCA) of two nodes in a binary tree is the deepest node that is a common ancestor of both nodes.
Start from the root node and traverse the tree to find the given nodes.
Store the paths from the root to each node.
Compare the paths to find the last common node, which is the LCA.
HashMap in Java is a data structure that stores key-value pairs and uses hashing to efficiently retrieve values.
HashMap uses an array of buckets to store key-value pairs.
The key is hashed to determine the index in the array where the value will be stored.
In case of hash collisions, a linked list or a balanced tree is used to store multiple values at the same index.
HashMap allows null keys and values.
Example: HashMap<String, Integer> map = new HashMap<>(); map.put("key1", 1);
Definite integral of a function within given limits a to b.
Use the definite integral formula: ∫[a, b] f(x) dx = F(b) - F(a), where F(x) is the antiderivative of f(x).
Calculate the antiderivative of the function and then evaluate it at the upper and lower limits.
Make sure to check for any discontinuities or singularities within the interval.
Example: Calculate ∫[0, 2] x^2 dx = (1/3)x^3 |[0, 2] = (1/3)(2^3) - (1/3)(0^3) = 8/3.
Q35. Given a million points and a new point P find a point closest to P(you can do preprocessing)
Find the point closest to a given point P among a million points.
Preprocess the million points to calculate their distances from P.
Store the distances and corresponding points in a data structure.
Sort the distances in ascending order.
Return the point corresponding to the smallest distance.
Q36. Why the particular technologies were used in the application I developed?
I chose the technologies based on their compatibility with the project requirements and my familiarity with them.
Chose React for front-end development due to its component-based architecture and ease of use
Used Node.js for back-end development because of its non-blocking I/O and scalability
Selected MongoDB as the database for its flexibility with unstructured data and ease of integration
The virtual keyword in C++ is used to declare a member function in a base class that can be overridden in derived classes.
Virtual functions allow for dynamic polymorphism in C++ by enabling late binding.
Virtual functions are declared in the base class with the 'virtual' keyword and can be overridden in derived classes.
When a derived class overrides a virtual function, the function in the derived class is called instead of the base class function.
Virtual functions are typicall...read more
C is a procedural language, C++ is an object-oriented language, and Java is a platform-independent language.
C is a procedural programming language, while C++ supports both procedural and object-oriented programming.
C++ is an extension of C with additional features like classes and inheritance.
Java is a platform-independent language that runs on a virtual machine and uses automatic memory management.
C is closer to the hardware and is used for system programming, while Java is ...read more
Collection Hierarchy in Java represents the relationship between various collection interfaces and classes.
Collection interface is the root interface in the Collection Hierarchy.
List and Set interfaces extend the Collection interface.
Map interface is not a subtype of Collection interface.
ArrayList, LinkedList, HashSet, and TreeSet are some of the classes that implement the Collection interfaces.
HashMap and TreeMap are classes that implement the Map interface.
Fragmentation in operating systems is the phenomenon where memory or disk space is divided into small chunks over time, leading to inefficient use of resources.
Fragmentation can occur in both memory (memory fragmentation) and disk space (disk fragmentation).
External fragmentation happens when free memory or disk space is broken into small pieces, making it difficult to allocate large contiguous blocks of memory or disk space.
Internal fragmentation occurs when allocated memory...read more
AtomicInteger is a class in Java that provides atomic operations on integers.
It is used for operations that need to be performed atomically, without interference from other threads.
Common methods include get(), set(), incrementAndGet(), decrementAndGet(), etc.
Example: AtomicInteger count = new AtomicInteger(0); count.incrementAndGet();
Q42. Explain polymorphism and other OOPS concepts
Polymorphism is the ability of an object to take on many forms. Other OOPS concepts include inheritance, encapsulation, and abstraction.
Polymorphism allows objects of different classes to be treated as objects of a common superclass.
Inheritance allows a class to inherit properties and methods from another class.
Encapsulation is the bundling of data and methods within a class, hiding the internal details.
Abstraction focuses on providing only essential information to the outsid...read more
Q43. what do you think abobut intuit "?
Intuit is a financial software company known for products like QuickBooks and TurboTax.
Intuit is a leading provider of financial software solutions for individuals and businesses.
They are known for products like QuickBooks, TurboTax, and Mint.
Intuit's software helps users manage their finances, taxes, and accounting efficiently.
The company focuses on simplifying financial tasks for users through user-friendly interfaces and automation.
Intuit has a strong reputation for custom...read more
Design a bus seat booking system.
Use a database to store seat availability and bookings
Implement a user interface for customers to select and book seats
Consider implementing a payment system for reservations
Allow for seat selection based on preferences such as window or aisle
Q45. how agile working methods
Agile working methods involve iterative development, collaboration, flexibility, and continuous improvement.
Agile methods prioritize customer satisfaction through early and continuous delivery of valuable software.
Teams work in short iterations called sprints, focusing on delivering working software frequently.
Collaboration between team members, stakeholders, and customers is essential for success.
Flexibility to adapt to changing requirements and feedback is a key principle o...read more
Q46. Integer to roman number
Convert integer to Roman numeral
Create a mapping of integer values to Roman numeral symbols
Iterate through the mapping to find the largest Roman numeral that fits the integer
Subtract the value of the Roman numeral from the integer and repeat until the integer becomes 0
More about working at Intuit
Interview Process at Accenture
Top Software Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month