Bank of America
10+ HouseFull Furniture Interview Questions and Answers
Q1. Beautiful String Problem Statement
Given a binary string STR
containing either '0' or '1', determine the minimum number of operations needed to make it beautiful. A binary string is called beautiful if it conta...read more
The problem involves determining the minimum number of operations needed to make a binary string beautiful by ensuring it contains alternating 0s and 1s.
Iterate through the binary string and count the number of operations needed to make it beautiful by flipping the bits as required.
Keep track of the current bit and compare it with the next bit to determine if a flip operation is needed.
Return the total number of operations needed for each test case.
Q2. 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.
Q3. Multiples of 2 and 3 Problem Statement
Ninja is engaged in a task involving divisors. He is given 'N' numbers, and his objective is to compute the sum of all numbers which are divisible by either 2 or 3.
Exampl...read more
Find the sum of numbers divisible by 2 or 3 from a given list of numbers.
Iterate through the list of numbers and check if each number is divisible by 2 or 3.
If a number is divisible by 2 or 3, add it to the sum.
Return the final sum as the output.
Q4. Alternate Print Problem Statement
Given two strings A
and B
, your task is to print these two strings in an alternating sequence by indices. That is, the first character of 'A', the first character of 'B', follo...read more
The task is to print two strings in an alternating sequence by indices.
Iterate through both strings simultaneously and append characters alternately
Handle the case where one string is longer than the other
Use two pointers to keep track of the current index in each string
Q5. Fourth Largest Element in the Array
Given an array consisting of integers, your task is to determine the fourth largest element in the array. If the array does not contain at least four distinct elements, retur...read more
Find the fourth largest element in an array of integers.
Sort the array in descending order to easily find the fourth largest element.
If the array has less than four distinct elements, return -2147483648.
Handle edge cases like empty array or array with less than four elements.
Q6. Merge Sort Problem Statement
You are given a sequence of numbers, ARR
. Your task is to return a sorted sequence of ARR
in non-descending order using the Merge Sort algorithm.
Explanation:
The Merge Sort algorit...read more
Implement Merge Sort algorithm to sort a sequence of numbers in non-descending order.
Divide the input array into two halves recursively until each array has only one element.
Merge the sorted halves to produce a completely sorted array.
Time complexity of Merge Sort is O(n log n).
Example: Input - [3, 1, 4, 1, 5], Output - [1, 1, 3, 4, 5]
Q7. Binary Palindrome Check
Given an integer N
, determine whether its binary representation is a palindrome.
Input:
The first line contains an integer 'T' representing the number of test cases.
The next 'T' lines e...read more
Check if the binary representation of a given integer is a palindrome.
Convert the integer to binary and check if the binary string is a palindrome.
Use bitwise operations to manipulate the binary representation of the integer.
Consider edge cases like handling leading zeros in the binary representation.
Q8. Quick Sort Problem Statement
You are provided with an array of integers. The task is to sort the array in ascending order using the quick sort algorithm.
Quick sort is a divide-and-conquer algorithm. It involve...read more
Yes, the quick sort algorithm can be enhanced to achieve NlogN complexity in the worst case by using a randomized pivot selection strategy.
Randomized pivot selection: Choose a random element as the pivot to reduce the chances of worst-case scenarios.
Median-of-three pivot selection: Select the median of the first, middle, and last elements as the pivot to improve partitioning.
Optimizing partitioning: Use efficient partitioning techniques like Hoare's partition scheme or Dutch ...read more
Q9. Find Pairs in a Doubly-Linked List
A sorted doubly-linked list of distinct positive integers is provided, along with an integer 'X'. Your task is to identify and print all unique pairs from the list whose sum e...read more
Find pairs in a sorted doubly-linked list whose sum equals a given integer 'X'.
Traverse the list from both ends to find pairs with sum equal to 'X'.
Use two pointers approach to efficiently find the pairs.
Handle cases where the sum is less than, equal to, or greater than 'X'.
Q10. Logical Question: You are a captive. If you say the right answer, the assasin will hang you, if you say the wrong answer, he will shoot you. How do you escape?
Answer: Ask the assassin, 'Will you hang me?' If he answers 'yes', then he should shoot you. If he answers 'no', then he should hang you.
Ask the assassin a question that will force him to give an answer that contradicts his actions.
The question should create a paradox or a situation where both answers lead to the opposite outcome.
In this case, asking the assassin if he will hang you will force him to give an answer that contradicts his actions.
Q11. Detect and Remove Loop in Linked List
For a given singly linked list, identify if a loop exists and remove it, adjusting the linked list in place. Return the modified linked list.
Expected Complexity:
Aim for a...read more
Detect and remove loop in a singly linked list in place with O(n) time complexity and O(1) space complexity.
Use Floyd's Cycle Detection Algorithm to identify the loop in the linked list.
Once the loop is detected, use two pointers to find the start of the loop.
Adjust the pointers to remove the loop and return the modified linked list.
Q12. If you given a string in which numbers are combined how to seperate the longest alphabetical sequence
The longest alphabetical sequence in a string of combined numbers can be separated using string manipulation and iteration.
Iterate through the string character by character
Check if the current character is alphabetical
If it is, start building a substring of alphabetical characters
If the next character is also alphabetical, add it to the substring
If the next character is not alphabetical, compare the length of the current substring to the longest substring found so far
If the c...read more
Q13. What core programming concepts were covered in your experience?
Covered core programming concepts include data structures, algorithms, object-oriented programming, and software design patterns.
Data structures such as arrays, linked lists, stacks, queues, trees, and graphs were covered.
Algorithms like sorting, searching, recursion, and dynamic programming were studied.
Object-oriented programming principles like inheritance, encapsulation, and polymorphism were implemented.
Software design patterns such as singleton, factory, observer, and s...read more
Q14. Var vs const vs let
Var, const, and let are all ways to declare variables in JavaScript, each with different scopes and mutability.
Var: function-scoped, can be redeclared and reassigned
Const: block-scoped, cannot be reassigned, but can be mutated for objects and arrays
Let: block-scoped, can be reassigned but not redeclared
Top HR Questions asked in HouseFull Furniture
Interview Process at HouseFull Furniture
Top Software Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month