Add office photos
Lifesight logo
Employer?
Claim Account for FREE

Lifesight

4.0
based on 16 Reviews
Filter interviews by
Software Developer
Experienced
Clear (1)

Lifesight Software Developer Interview Questions and Answers

Updated 5 Feb 2024

Q1. Longest Substring with K Distinct Characters

You are provided with a string S of length N, consisting of lowercase English alphabet letters, and a positive integer K.

Your task is to determine the maximum lengt...read more

Ans.

Find the longest substring with at most K distinct characters in a given string.

  • Use a sliding window approach to keep track of the characters and their counts in the substring.

  • Maintain a hashmap to store the characters and their frequencies.

  • Update the window size and characters count as you iterate through the string.

  • Return the maximum length of the substring with at most K distinct characters.

Add your answer
right arrow

Q2. Combination Sum Problem Statement

Given an array of distinct positive integers ARR and a non-negative integer 'B', find all unique combinations in the array where the sum is equal to 'B'. Numbers can be chosen ...read more

Ans.

Find all unique combinations in an array where the sum is equal to a given target sum, with elements in non-decreasing order.

  • Use backtracking to generate all possible combinations of elements in the array that sum up to the target sum.

  • Sort the array to ensure elements in each combination are in non-decreasing order.

  • Handle duplicate elements in the array to avoid duplicate combinations.

  • Consider edge cases like empty array, target sum of 0, and negative integers in the array.

Add your answer
right arrow

Q3. Validate Binary Search Tree (BST)

You are given a binary tree with 'N' integer nodes. Your task is to determine whether this binary tree is a Binary Search Tree (BST).

BST Definition:

A Binary Search Tree (BST)...read more

Ans.

Validate if a given binary tree is a Binary Search Tree (BST) or not.

  • Check if the left subtree of a node contains only nodes with data less than the node's data.

  • Check if the right subtree of a node contains only nodes with data greater than the node's data.

  • Recursively check if both the left and right subtrees are also binary search trees.

  • Example: For each node, validate if its left child is less than the node and right child is greater than the node.

Add your answer
right arrow

Q4. Cycle Detection in Undirected Graph Problem Statement

You are provided with an undirected graph containing 'N' vertices and 'M' edges. The vertices are numbered from 1 to 'N'. Your objective is to determine whe...read more

Ans.

Detect if an undirected graph contains a cycle.

  • Use depth-first search (DFS) to detect cycles in the graph.

  • Maintain a visited array to keep track of visited vertices.

  • If a visited vertex is encountered again during DFS, a cycle exists.

  • Consider disconnected graphs as well.

  • Example: For input N=3, Edges=[[1, 2], [2, 3], [1, 3]], output is Yes.

Add your answer
right arrow
Discover Lifesight interview dos and don'ts from real experiences

Q5. Covid Vaccination Distribution Problem

As the Government ramps up vaccination drives to combat the second wave of Covid-19, you are tasked with helping plan an effective vaccination schedule. Your goal is to ma...read more

Ans.

Given constraints and rules, find maximum vaccines administered on a specific day during a vaccination drive.

  • Iterate through each test case and calculate the maximum number of vaccines distributed on the specified day.

  • Distribute vaccines evenly across days while maximizing the number on the specified day.

  • Ensure that the sum of vaccines administered does not exceed the maximum allowed.

  • Consider edge cases like when the number of days is equal to the maximum number of vaccines a...read more

Add your answer
right arrow

Q6. Sliding Window Maximum Problem Statement

You are given an array/list of integers with length 'N'. A sliding window of size 'K' moves from the start to the end of the array. For each of the 'N'-'K'+1 possible wi...read more

Ans.

Sliding window maximum problem where we find maximum element in each window of size K.

  • Use a deque to store indices of elements in decreasing order within the window.

  • Pop elements from the deque that are out of the current window.

  • Append the maximum element from the front of the deque to the result for each window.

Add your answer
right arrow
Contribute & help others!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
interview tips and stories logo
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Software Developer Interview Questions from Similar Companies

Capgemini Logo
3.7
 • 113 Interview Questions
Flipkart Logo
4.0
 • 81 Interview Questions
Paytm Logo
3.3
 • 46 Interview Questions
Qualcomm Logo
3.8
 • 11 Interview Questions
View all
Recently Viewed
INTERVIEWS
Merkle Sokrati
No Interviews
INTERVIEWS
MAHLE ANAND Filter Systems
No Interviews
SALARIES
Infosys Public Services
INTERVIEWS
MAHLE ANAND Filter Systems
No Interviews
INTERVIEWS
MAHLE ANAND Filter Systems
No Interviews
SALARIES
Infosys Public Services
INTERVIEWS
Merkle Sokrati
No Interviews
INTERVIEWS
MAHLE ANAND Filter Systems
No Interviews
SALARIES
Merkle Sokrati
INTERVIEWS
Pioneer e Solutions
No Interviews
Share an Interview
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
75 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

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