Software Developer

filter-iconFilter interviews by

7000+ Software Developer Interview Questions and Answers

Updated 3 Mar 2025

Popular Companies

search-icon

Q101. Square Root (Integral) Problem Statement

Given a number N, calculate its square root and output the integer part only.

Example:

Input:
18
Output:
4
Explanation:

The square root of 18 is approximately 4.24. The ...read more

Ans.

Calculate the integer square root of a given number.

  • Use binary search to find the square root of the number.

  • Start with a range from 0 to N, and iteratively narrow down the range until you find the integer square root.

  • Return the integer part of the square root as the output.

Q102. Strings of Numbers Problem Statement

You are given two integers 'N' and 'K'. Consider a set 'X' of all possible strings of 'N' number of digits where all strings only contain digits ranging from 0 to 'K' inclus...read more

Ans.

The task is to find a string of minimal length that includes every possible string of N digits with digits ranging from 0 to K as substrings.

  • Generate all possible strings of N digits with digits from 0 to K

  • Concatenate these strings in a way that all are substrings of the final string

  • Return 1 if the final string contains all possible strings, else return 0

Q103. Delete Alternate Nodes from a Singly Linked List

Given a Singly Linked List of integers, remove all the alternate nodes from the list.

Input:

The first and the only line of input will contain the elements of th...read more
Ans.

Remove alternate nodes from a singly linked list of integers.

  • Traverse the linked list and skip every alternate node while updating the next pointers.

  • Make sure to handle cases where there are less than 3 nodes in the list.

  • Update the next pointers accordingly to remove alternate nodes.

  • Example: Input: 10 20 30 40 50 60 -1, Output: 10 30 50

Q104. Fruits and Baskets Problem Statement

You are given 'n' fruit trees planted along a road, numbered from 0 to n-1. Each tree bears a fruit type represented by an uppercase English alphabet. A Ninja walking along ...read more

Ans.

The problem is to find the maximum number of fruits the Ninja can put in both baskets after satisfying given conditions.

  • The Ninja can start at any tree and end at any tree, but cannot skip a tree.

  • He can pick one fruit from each tree until he cannot, i.e., when he has to pick a fruit of the third type.

  • The restriction is that each basket can have only one type of fruit.

  • We need to find the maximum number of fruits that can be put in both baskets.

Are these interview questions helpful?

Q105. Is the Sentence a Pangram?

Ninja is relocating to a place called NinjaGram, and for school admission, he is required to identify if a given sentence is a pangram. Your task is to assist Ninja in determining if ...read more

Ans.

Yes, the sentence is a pangram if it includes every letter of the English alphabet at least once.

  • Check if the sentence contains all 26 letters of the English alphabet.

  • Convert the sentence to lowercase to simplify the checking process.

  • Use a set to keep track of the letters present in the sentence.

  • Iterate through the sentence and add each unique letter to the set.

  • After iterating, check if the set contains all 26 letters.

Q106. Last Stone Weight Problem Explanation

Given a collection of stones, each having a positive integer weight, perform the following operation: On each turn, select the two heaviest stones and smash them together. ...read more

Ans.

This question is about finding the weight of the last stone after repeatedly smashing the two heaviest stones together.

  • Sort the array of stone weights in descending order.

  • Repeatedly smash the two heaviest stones together until there is at most 1 stone left.

  • If there is 1 stone left, return its weight. Otherwise, return 0.

Share interview questions and help millions of jobseekers 🌟

man-with-laptop

Q107. Problem: Sort an Array of 0s, 1s, and 2s

Given an array/list ARR consisting of integers where each element is either 0, 1, or 2, your task is to sort this array in increasing order.

Input:

The input starts with...read more
Ans.

The task is to sort an array of 0s, 1s, and 2s in increasing order.

  • Use a three-pointer approach to partition the array into three sections: 0s, 1s, and 2s.

  • Initialize three pointers: low, mid, and high. low points to the start of the array, mid points to the current element being processed, and high points to the end of the array.

  • While mid <= high, perform the following checks: if arr[mid] == 0, swap arr[low] and arr[mid], increment low and mid. If arr[mid] == 1, increment mid...read more

Q108. 0/1 Knapsack Problem Statement

A thief is planning to rob a store and can carry a maximum weight of 'W' in his knapsack. The store contains 'N' items where the ith item has a weight of 'wi' and a value of 'vi'....read more

Ans.

Yes, the 0/1 Knapsack problem can be solved using dynamic programming with a space complexity of not more than O(W).

  • Use a 1D array to store the maximum value that can be stolen for each weight from 0 to W.

  • Iterate through each item and update the array based on whether including the item would increase the total value.

  • The final value in the array at index W will be the maximum value that can be stolen.

Software Developer Jobs

Software Developer 8-13 years
Siemens Healthcare
4.3
Bangalore / Bengaluru
Software Developer- Java 2-4 years
Ericsson India Global Services Pvt. Ltd.
4.1
Chennai
Software Developer 3-9 years
Siemens Healthcare
4.3
Bangalore / Bengaluru

Q109. A ball is left from a height of 10 meters. After bouncing first time it looses 10% of its previous height the next time it bounces. Write a code to calculate the number of bounces the ball goes through until it...

read more
Ans.

Code to calculate number of bounces a ball goes through until it comes to rest.

  • Use a loop to simulate the bounces until the ball stops bouncing

  • Calculate the height of each bounce using the given formula

  • Keep track of the number of bounces in a counter variable

Q110. Car Pooling Problem Statement

You are tasked with driving a cab that moves in a straight line, only forward, and initially has 'C' empty seats available for passengers.

Given 'N' trips, each defined by three in...read more

Ans.

The problem involves determining if a cab with a certain capacity can successfully pick up and drop off passengers at specified points for multiple trips.

  • Create a function that takes in the car's capacity, number of trips, and trip details as input

  • Iterate through each trip and check if the total number of passengers picked up and dropped off is within the car's capacity

  • Return 'True' if all trips can be successfully completed, 'False' otherwise

Q111. Chess Tournament Problem Statement

In Ninjaland, a chess tournament is being organized with C chess players attending. They will all stay in a hotel that has N available rooms. Each player will choose one room,...read more

Ans.

Assign rooms to chess players to maximize overall focus level by minimizing distance between rooms.

  • Sort the positions of rooms in ascending order.

  • Calculate the distances between adjacent rooms.

  • Select rooms with minimum distances to maximize overall focus level.

Q112. Count Inversions Problem Statement

Given an integer array ARR of size N, your task is to find the total number of inversions that exist in the array.

An inversion is defined for a pair of integers in the array ...read more

Ans.

Count the total number of inversions in an integer array.

  • Iterate through the array and for each pair of indices i and j, check if ARR[i] > ARR[j] and i < j.

  • Use a nested loop to compare all pairs of elements in the array.

  • Keep a count of the inversions found and return the total count at the end.

Q113. Dice Throws Problem Statement

You are given D dice, each having F faces numbered from 1 to F. The task is to determine the number of possible ways to roll all the dice such that the sum of the face-up numbers e...read more

Ans.

The task is to determine the number of possible ways to roll all the dice such that the sum of the face-up numbers equals the given 'target' sum.

  • Use dynamic programming to solve the problem efficiently.

  • Create a 2D array to store the number of ways to achieve each sum with the given number of dice.

  • Iterate through the dice and faces to calculate the number of ways to reach each sum.

  • Return the result modulo 10^9 + 7.

  • Optimize the solution to use no more than O(S) extra space by u...read more

Q114. First Unique Character in a Stream Problem Statement

Given a string A consisting of lowercase English letters, determine the first non-repeating character at each point in the stream of characters.

Example:

Inp...read more
Ans.

Given a string of lowercase English letters, find the first non-repeating character at each point in the stream.

  • Create a hashmap to store the frequency of each character as it appears in the stream.

  • Iterate through the stream and check the frequency of each character to find the first non-repeating character.

  • Output the first non-repeating character at each point in the stream.

Q115. 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

Ans.

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.

Q116. Time to Burn Tree Problem

You are given a binary tree consisting of 'N' unique nodes and a start node where the burning will commence. The task is to calculate the time in minutes required to completely burn th...read more

Ans.

Calculate the time in minutes required to completely burn a binary tree starting from a given node.

  • Traverse the tree to find the start node and calculate the time for fire to spread to all nodes.

  • Use a queue to keep track of nodes to be burnt next.

  • Increment time for each level of nodes burnt until the entire tree is burnt.

Q117. Weighted Job Scheduling Problem Statement

You have 'N' jobs, each with a start time, end time, and profit. Your task is to identify the maximum profit that can be earned by scheduling these jobs such that no tw...read more

Ans.

The Weighted Job Scheduling problem involves maximizing profit by scheduling non-overlapping jobs with start time, end time, and profit given.

  • Sort the jobs based on their end times in ascending order.

  • Initialize an array 'dp' to store the maximum profit that can be earned by scheduling jobs up to that index.

  • For each job, find the maximum profit by either including or excluding the current job based on non-overlapping condition.

  • Return the maximum profit from the 'dp' array.

  • Exam...read more

Q118. Count Pairs Problem Statement

You are given an array A of length N consisting only of integers. Additionally, you are provided with three integers X, Y and SUM. Your task is to count the number of pairs (i, j) ...read more

Ans.

Count the number of pairs in an array that satisfy a given equation.

  • Iterate through all pairs of indices in the array and check if the equation is satisfied.

  • Use a hashmap to store the frequency of values that can be used to form pairs.

  • Optimize the solution by using two pointers approach to find pairs efficiently.

Q119. Count Pairs with Difference K

Given an array of integers and an integer K, determine and print the count of all pairs in the array that have an absolute difference of K.

Input:
The first line of the input conta...read more
Ans.

Count pairs in an array with a specific absolute difference.

  • Iterate through the array and for each element, check if the element + K or element - K exists in the array.

  • Use a hash set to store elements for constant time lookups.

  • Keep track of the count of valid pairs found.

Q120. Median of Subarrays of Specific Size

Given an integer array ARR of size N and a specified subarray size M, calculate and return the median of all subarrays of size M starting from the left of the array.

The med...read more

Ans.

Calculate and return the median of all subarrays of a specified size in an integer array.

  • Iterate through the array and for each subarray of size M, calculate the median.

  • If the size of the subarray is even, take the average of the two middle numbers as the median.

  • Return the list of medians for all subarrays of size M.

Q121. Reverse Words in a String: Problem Statement

You are given a string of length N. Your task is to reverse the string word by word. The input may contain multiple spaces between words and may have leading or trai...read more

Ans.

Reverse words in a string while handling leading, trailing, and multiple spaces.

  • Split the input string by spaces to get individual words

  • Reverse the order of the words

  • Join the reversed words with a single space in between

Q122. Sort 0 and 1 Problem Statement

Given an integer array ARR of size N containing only integers 0 and 1, implement a function to sort this array. The solution should scan the array only once without using any addi...read more

Ans.

Sort an array of 0s and 1s in linear time without using additional arrays.

  • Iterate through the array and maintain two pointers, one for 0s and one for 1s.

  • Swap elements at the two pointers based on the current element being 0 or 1.

  • Continue this process until the entire array is sorted in place.

Q123. Batch Photography Problem

Alex has acquired a machine that can photocopy photos in batches of a minimum size 'K'. Given 'N' photos with resolutions represented in an integer array photos, the machine produces a...read more

Ans.

Minimize maximum error by splitting photos into batches of size at least 'K'.

  • Sort the array of resolutions in ascending order.

  • Iterate through the array and calculate the error for each possible batch.

  • Return the minimum possible maximum error found.

Q124. Count Ways to Climb Stairs Problem

Given a staircase with a certain number of steps, you start at the 0th step, and your goal is to reach the Nth step. At every step, you have the option to move either one step...read more

Ans.

Count the number of distinct ways to climb a staircase with a certain number of steps using either one or two steps at a time.

  • Use dynamic programming to solve this problem efficiently.

  • Keep track of the number of ways to reach each step by considering the number of ways to reach the previous two steps.

  • Return the result modulo 10^9+7 to handle large outputs.

  • Example: For N=4, the distinct ways to climb are {(0,1,2,3,4)}, {(0,1,2,4)}, {(0,2,3,4)}, {(0,1,3,4)}, and {(0,2,4)} total...read more

Q125. Day of the Week Calculation

Your task is to create a function that determines the day of the week for any given date, whether in the past or the future.

Input:

The first line consists of an integer 'T', represe...read more
Ans.

Create a function to determine the day of the week for any given date.

  • Parse the input integers to create a date object

  • Use a library or algorithm to calculate the day of the week for the given date

  • Return the corresponding day of the week as a string

Q126. Kevin and His Cards Problem Statement

Kevin has two packs of cards. The first pack contains N cards, and the second contains M cards. Each card has an integer written on it. Determine two results: the total num...read more

Ans.

Find total distinct card types and common card types between two packs of cards.

  • Create a set to store distinct card types when combining both packs.

  • Iterate through each pack and add card types to the set.

  • Find the intersection of card types between the two packs to get common card types.

Q127. Maximum Sum of Non-Adjacent Elements

Given an array/list of ‘N’ integers, your task is to return the maximum sum of the subsequence where no two elements are adjacent in the given array/list.

Example:

Input:
T ...read more
Ans.

Find the maximum sum of non-adjacent elements in an array.

  • Use dynamic programming to keep track of the maximum sum at each index, considering whether to include the current element or skip it.

  • At each index, the maximum sum is either the sum of the current element and the element two positions back, or the sum at the previous index.

  • Iterate through the array and update the maximum sum at each index accordingly.

  • Return the maximum sum obtained at the last index as the final resul...read more

Q128. 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

Ans.

Calculate the N-th term of a Geometric Progression series given the first term, common ratio, and term position.

  • Use the formula A * R^(N-1) to find the N-th term of the GP series.

  • Remember to return the result modulo 10^9 + 7 as the term can be very large.

  • Handle multiple test cases efficiently by iterating through each case.

Q129. Non-Decreasing Array Problem Statement

Given an integer array ARR of size N, determine if it can be transformed into a non-decreasing array by modifying at most one element.

An array is defined as non-decreasin...read more

Ans.

Determine if an array can be transformed into a non-decreasing array by modifying at most one element.

  • Iterate through the array and check if there are more than one decreasing elements.

  • If there is only one decreasing element, check if modifying it can make the array non-decreasing.

  • Return true if the array can be made non-decreasing by modifying at most one element, otherwise false.

Q130. Relative Sorting Problem Statement

You are given two arrays, 'ARR' of size 'N' and 'BRR' of size 'M'. Your task is to sort the elements of 'ARR' such that their relative order matches that in 'BRR'. Any element...read more

Ans.

The task is to sort the elements of ARR in such a way that the relative order among the elements will be the same as those are in BRR. For the elements not present in BRR, append them in the last in sorted order.

  • Create a frequency map of elements in ARR

  • Iterate through BRR and for each element, append it to the result array the number of times it appears in ARR

  • Iterate through the frequency map and for each element not present in BRR, append it to the result array

  • Sort the resul...read more

Q131. Search for Indices with Given Difference and Distance

You are provided with an array containing 'N' non-negative integers, along with two other non-negative integers 'K' and 'M'. Your task is to identify and re...read more

Ans.

Find a pair of indices in an array with given difference and distance constraints.

  • Iterate through the array and check all possible pairs of indices to satisfy the conditions

  • Use nested loops to compare each pair of indices and their corresponding elements

  • Return 'valid' if a pair of indices is found that meets the conditions, otherwise return 'invalid'

Q132. Split Array with Equal Sums Problem Statement

Given an array 'ARR' of size 'N', determine if there exists a triplet (i, j, k) satisfying the conditions: 0 < i , i + 1 < j , j + 1 < k and k < N - 1, such that th...read more

Ans.

The problem involves determining if there exists a triplet in an array such that the sums of specific subarrays are equal.

  • Iterate through all possible triplets (i, j, k) satisfying the given conditions.

  • Calculate the sum of subarrays [0, i - 1], [i + 1, j - 1], [j + 1, k - 1], [k + 1, N - 1] for each triplet.

  • Check if any triplet has equal sums for the subarrays, return True if found, else False.

Q133. Trapping Rain Water in 2-D Elevation Map

You're given an M * N matrix where each value represents the height of that cell on a 2-D elevation map. Your task is to determine the total volume of water that can be ...read more

Ans.

Calculate the total volume of water that can be trapped in a 2-D elevation map after rain.

  • Iterate over the matrix and find the maximum height on the borders.

  • Calculate the water trapped at each cell by finding the difference between the cell's height and the minimum of its neighboring maximum heights.

  • Sum up the trapped water for all cells to get the total volume of water trapped.

Q134. Q1. Why is String Immutable? What is String Pool? How to create a String which is not stored in String Pool? What is REST Web Service? Life Cycle of a thread? If Rest is Stateless How do you maintain Sessions?...

read more
Ans.

What is the difference between abstract class and interface?

  • Abstract class can have both abstract and non-abstract methods, while interface can only have abstract methods.

  • A class can implement multiple interfaces, but can only extend one abstract class.

  • Abstract classes can have constructors, while interfaces cannot.

  • Interfaces are used to achieve multiple inheritance in Java.

  • Example: Abstract class - Animal, Interface - Flyable

  • Example: Abstract class - Shape, Interface - Drawa...read more

Q135. 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

Ans.

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

Q136. Idempotent Matrix Verification

Determine if a given N * N matrix is an idempotent matrix. A matrix is considered idempotent if it satisfies the following condition:

M * M = M

Input:

The first line contains a si...read more
Ans.

Check if a given matrix is idempotent by verifying if M * M = M.

  • Iterate through the matrix and multiply it with itself to check if it equals the original matrix.

  • If the condition M * M = M is satisfied, then the matrix is idempotent.

  • If the condition is not satisfied, then the matrix is not idempotent.

Q137. Kth Smallest Element in an Unsorted Array

Given an unsorted array arr of distinct integers and an integer k, your task is to find the k-th smallest element in the array.

Input:

The first line of input contains ...read more
Ans.

Find the k-th smallest element in an unsorted array of distinct integers.

  • Sort the array and return the k-th element.

  • Use a priority queue or quickselect algorithm for efficient solution.

  • Handle edge cases like k being out of bounds or array being empty.

Q138. Minimum Fountains Activation Problem

In this problem, you have a one-dimensional garden of length 'N'. Each position from 0 to 'N' has a fountain that can provide water to the garden up to a certain range. Thus...read more

Ans.

Find the minimum number of fountains to activate to water the entire garden.

  • Iterate through the array to find the coverage of each fountain.

  • Keep track of the farthest coverage reached by activating fountains.

  • Activate the fountain that covers the farthest point not yet covered.

  • Repeat until the entire garden is watered.

Q139. Palindromic Substrings Problem Statement

You are given a string 'STR'. Your task is to determine the total number of palindromic substrings present in 'STR'.

Example:

Input:
"abbc"
Output:
5
Explanation:

The pa...read more

Ans.

Count the total number of palindromic substrings in a given string.

  • Iterate through each character in the string and expand around it to find palindromic substrings.

  • Use dynamic programming to store the results of subproblems to avoid redundant calculations.

  • Consider both odd and even length palindromes while counting.

  • Example: For input 'abbc', the palindromic substrings are ['a', 'b', 'b', 'c', 'bb'], totaling 5.

Q140. Sum of Minimum and Maximum Elements of All Subarrays of Size K

You are provided with an array containing N integers along with an integer K. Your task is to compute the total sum of the minimum and maximum elem...read more

Ans.

Calculate the sum of minimum and maximum elements of all subarrays of size K in an array.

  • Iterate through the array and maintain a deque to store the indices of elements in the current window of size K.

  • Keep track of the minimum and maximum elements in the current window using the deque.

  • Calculate the sum of minimum and maximum elements for each subarray of size K and return the total sum.

Q141. XOR Query on Tree Problem

Given a tree with a root at node 0 and N vertices connected with N-1 edges, and an array QUERY of size Q, where each element in the array represents a node in the tree. For each node i...read more

Ans.

This question is about finding the XOR of all values of nodes in the sub-tree of a given node in a tree.

  • Read the input values for the number of test cases, number of nodes, and number of queries.

  • Construct the tree using the given edges.

  • For each query, traverse the sub-tree of the given node and calculate the XOR of all node values.

  • Print the XOR values for each query.

Q142. Find the Duplicate Number Problem Statement

Given an integer array 'ARR' of size 'N' containing numbers from 0 to (N - 2). Each number appears at least once, and there is one number that appears twice. Your tas...read more

Ans.

Find the duplicate number in an array of integers from 0 to N-2.

  • Iterate through the array and keep track of the frequency of each number using a hashmap.

  • Return the number with a frequency greater than 1 as the duplicate number.

  • Alternatively, use Floyd's Tortoise and Hare algorithm to find the duplicate number in O(N) time and O(1) space.

Q143. Find the Longest Palindromic Substring

Given a string ‘S’ composed of lowercase English letters, your task is to identify the longest palindromic substring within ‘S’.

If there are multiple longest palindromic ...read more

Ans.

Find the longest palindromic substring in a given string, returning the rightmost one if multiple substrings are of the same length.

  • Iterate through each character in the string and expand around it to find palindromic substrings

  • Keep track of the longest palindromic substring found so far

  • Return the rightmost longest palindromic substring

Q144. Flip Equivalent Binary Tree Problem

Determine whether two binary trees, given by their roots 'ROOT1' and 'ROOT2', are flip equivalent. A tree can be transformed into a flip equivalent through any number of flip...read more

Ans.

The problem is to determine if two binary trees are flip equivalent after performing flip operations on one of the trees.

  • Perform a depth-first search (DFS) on both trees simultaneously

  • At each node, check if the values are equal and the left and right subtrees are either both null or both not null

  • If the above conditions are met, recursively check the flip equivalence of the left and right subtrees

  • If any of the conditions fail at any node, the trees are not flip equivalent

Q145. 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

Ans.

Find the fourth largest element in an array, return -2147483648 if not enough distinct elements.

  • Sort the array in descending order

  • Return the fourth element if it exists, else return -2147483648

Q146. Given a 10 digit number, sort the individual digits of the number.

Ans.

Sort the individual digits of a 10 digit number.

  • Convert the number to a string to access individual digits

  • Use a sorting algorithm to sort the digits

  • Convert the sorted digits back to a number

Q147. Longest Palindromic Subsequence Problem Statement

Given a string A consisting of lowercase English letters, determine the length of the longest palindromic subsequence within A.

Explanation:

  • A subsequence is d...read more
Ans.

The task is to find the length of the longest palindromic subsequence in a given string.

  • A subsequence is a sequence generated from a string after deleting some or no characters of the string without changing the order of the remaining string characters.

  • A string is said to be palindrome if the reverse of the string is the same as the actual string.

  • Find the longest palindromic subsequence by considering all possible subsequences of the given string.

  • Use dynamic programming to ef...read more

Q148. Longest Subarray with Zero Sum

Ninja enjoys working with numbers, and as a birthday challenge, his friend provides him with an array consisting of both positive and negative integers. Ninja is curious to identi...read more

Ans.

Find the length of the longest subarray with zero sum in an array of integers.

  • Iterate through the array and keep track of the running sum using a hashmap.

  • If the running sum is seen before, the subarray between the current index and the previous index with the same sum is a subarray with zero sum.

  • Update the length of the longest subarray with zero sum as you iterate through the array.

  • Example: For arr1 = [1, -1, 3, 2, -2, -3, 3], the longest subarray with zero sum is [3, 2, -2,...read more

Q149. Meeting Rescheduling Challenge

Ninja is tasked with organizing a meeting in an office that starts at time ‘0’ and ends at time ‘LAST’. There are ‘N’ presentations scheduled with given start and end times. The p...read more

Ans.

Reschedule at most K presentations to maximize longest gap without overlap.

  • Iterate through presentations and calculate the gap between each pair of presentations

  • Sort the presentations by their start times and keep track of the longest gap

  • Reschedule at most K presentations to maximize the longest gap without overlap

Q150. Palindrome String Validation

Determine if a given string 'S' is a palindrome, considering only alphanumeric characters and ignoring spaces and symbols.

Note:
The string 'S' should be evaluated in a case-insensi...read more
Ans.

The task is to check whether a given string is a palindrome or not, considering only alphabets and numbers and ignoring symbols and whitespaces.

  • Convert the string to lowercase and remove all symbols and whitespaces.

  • Reverse the modified string and compare it with the original string.

  • If they are equal, then the string is a palindrome.

  • If not, then the string is not a palindrome.

Previous
1
2
3
4
5
6
7
Next
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Interview experiences of popular companies

3.7
 • 10.4k Interviews
3.8
 • 8.2k Interviews
3.6
 • 7.6k Interviews
3.7
 • 5.6k Interviews
3.7
 • 5.6k Interviews
4.1
 • 5k Interviews
3.7
 • 4.8k Interviews
3.5
 • 1.3k Interviews
3.7
 • 514 Interviews
4.3
 • 505 Interviews
View all

Calculate your in-hand salary

Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary

Recently Viewed
SALARIES
NTT Data
COMPANY BENEFITS
Wipro
No Benefits
COMPANY BENEFITS
Wipro
No Benefits
DESIGNATION
SALARIES
Cyient
DESIGNATION
DESIGNATION
COMPANY BENEFITS
Tech Mahindra
No Benefits
REVIEWS
HCLTech
No Reviews
REVIEWS
IBM
No Reviews
Software Developer Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter