Premium Employer

Infosys

3.6
based on 39.4k Reviews
Filter interviews by

Datafortune Interview Questions and Answers

Updated 5 Aug 2024
Popular Designations
Asked in
SDE Interview

Q1. Return Subsets Sum to K Problem Statement

Given an integer array 'ARR' of size 'N' and an integer 'K', return all the subsets of 'ARR' which sum to 'K'.

Explanation:

A subset of an array 'ARR' is a tuple that c...read more

Ans.

Given an array and an integer, return all subsets that sum to the given integer.

  • Use backtracking to generate all possible subsets of the array.

  • For each subset, check if the sum equals the given integer 'K'.

  • Print the subsets that satisfy the condition.

  • Example: For input [1, 2, 3] and K=3, subsets [1, 2] and [3] have sum 3.

Add your answer
Asked in
SDE Interview

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

Ans.

Find the length of the longest strictly increasing subsequence in an array of integers.

  • Use dynamic programming to keep track of the longest increasing subsequence ending at each element.

  • Initialize an array to store the length of the longest increasing subsequence ending at each index.

  • Iterate through the array and update the length of the longest increasing subsequence for each element.

  • Return the maximum value in the array as the length of the longest increasing subsequence.

Add your answer
Asked in
SDE Interview

Q3. Count Inversions Problem Statement

Given an integer array ARR of size N containing all distinct values, determine the total number of inversions present in the array.

An inversion is defined for a pair of integ...read more

Ans.

Count the total number of inversions in an integer array.

  • Iterate through the array and for each pair of elements, check if the conditions for inversion are met.

  • Use a nested loop to compare each element with all elements to its right.

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

Add your answer
Asked in
SDE Interview

Q4. Bipartite Graph Problem

Check whether a given graph is bipartite or not. Return true if the graph's vertices can be divided into two independent sets, ‘U’ and ‘V’, such that every edge (‘u’, ‘v’) either connect...read more

Ans.

Check if a given graph is bipartite by dividing vertices into two independent sets.

  • Use BFS or DFS to traverse the graph and assign colors to vertices to check for bipartiteness.

  • If an edge connects vertices of the same color, the graph is not bipartite.

  • Return true if all edges connect vertices of different colors, else return false.

Add your answer
Discover Datafortune interview dos and don'ts from real experiences
Asked in
SDE Interview

Q5. Boundary Traversal of Binary Tree

Given a binary tree of integers, your task is to print the boundary nodes of the binary tree in an anti-clockwise direction starting from the root node.

Note:
The boundary incl...read more
Ans.

Boundary traversal of a binary tree in anti-clockwise direction starting from the root node.

  • Implement a function to calculate the boundary traversal of a binary tree

  • Include nodes from left boundary, leaf nodes, and right boundary in sequence

  • Ensure only unique nodes are included in the output

  • Print the boundary nodes separated by single spaces for each test case

Add your answer
Asked in
SDE Interview

Q6. what is annotation in spring boot

Ans.

Annotations in Spring Boot are used to provide metadata about the application's components, helping Spring to understand how to manage them.

  • Annotations are used to configure Spring Boot components such as controllers, services, repositories, etc.

  • Annotations help Spring Boot to automatically detect and configure beans based on the annotations used.

  • Examples of annotations in Spring Boot include @RestController, @Service, @Repository, @Autowired, @Component, etc.

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos

Interview Process at Datafortune

based on 4 interviews
Interview experience
4.3
Good
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top SDE Interview Questions from Similar Companies

4.1
 • 47 Interview Questions
4.0
 • 14 Interview Questions
4.3
 • 14 Interview Questions
View all
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
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