DSA

Data Structures and Algorithms questions covering sorting, searching, and problem-solving techniques

7
Easy Questions
11
Medium Questions
4
Hard Questions

Easy Questions (7)

#405EasyDSAImportant

Write a function to check if a given string is a palindrome. Implement solutions for: (a) Case-sensitive, (b) Case-insensitive, (c) Ignoring spaces and special characters.

algorithmstringpalindromedarttwo-pointer
View Details →CodeResources
#406EasyDSAImportant

Write a function to generate the first N Fibonacci numbers. Implement both iterative and recursive solutions and explain the time complexity of each.

algorithmrecursioniterationdynamic-programmingfibonacci
View Details →CodeResources
#409EasyDSAImportant

Write a function to reverse a string in Dart. Implement at least 3 different approaches and compare their performance.

algorithmstringreversedarttwo-pointer
View Details →CodeResources
#410EasyDSA

Write a function to remove all duplicate elements from a list, keeping only the first occurrence. Implement both approaches: (a) Preserving order, (b) Without preserving order.

algorithmsetduplicatesdartlist
View Details →CodeResources
#411EasyDSA

Write a function to find both the maximum and minimum values in a list of integers in a single pass (without using built-in max/min functions).

algorithmlinear-searchoptimizationdartarray
View Details →CodeResources
#412EasyDSA

Write a function to calculate the factorial of a number. Implement both recursive and iterative approaches. What is the maximum number for which factorial can be calculated in Dart?

algorithmrecursioniterationfactorialdart
View Details →CodeResources
#413EasyDSA

Given a list of integers from 1 to 100, write functions to: (a) Return all even numbers, (b) Return all odd numbers, (c) Separate into two lists.

algorithmfilteringlistdartfunctional-programming
View Details →CodeResources

Medium Questions (11)

#407MediumDSA

Write a function to find all duplicate elements in a list of integers. Return a list of unique duplicates (each duplicate should appear only once in the result).

algorithmhash-setduplicatesdartdata-structures
View Details →CodeResources
#408MediumDSAImportant

Given a list of integers and a target sum, write a function to find two numbers that add up to the target. Return their indices. If no such pair exists, return null.

algorithmhash-maptwo-sumdartarray
View Details →CodeResources
#414MediumDSA

Write a function to rotate a list by K positions to the right. For example, [1,2,3,4,5] rotated by 2 becomes [4,5,1,2,3].

algorithmarrayrotationdartlist
View Details →CodeResources
#415MediumDSA

Implement the Bubble Sort algorithm in Dart. Explain its time complexity in best, average, and worst cases. When would you use it in production?

algorithmsortingbubble-sortdarttime-complexity
View Details →CodeResources
#416MediumDSAImportant

Implement binary search algorithm in Dart. Include both iterative and recursive versions. What are the prerequisites for using binary search?

algorithmsearchingbinary-searchdartdivide-conquer
View Details →CodeResources
#417MediumDSA

Given a sorted list and a target value, find the starting and ending position of the target. If not found, return [-1, -1]. Optimize for O(log n) time.

algorithmsearchingbinary-searchdartarray
View Details →CodeResources
#418MediumDSA

Write a function to merge two sorted lists into one sorted list. Optimize for minimal space usage.

algorithmsortingmergetwo-pointerdart
View Details →CodeResources
#420MediumDSAImportant

Implement a Stack data structure in Dart with operations: push, pop, peek, isEmpty, and size. Use it to check if parentheses are balanced in an expression.

data-structurestacklifodartbalanced-parentheses
View Details →CodeResources
#421MediumDSA

Implement a Queue data structure in Dart with operations: enqueue, dequeue, peek, isEmpty, and size. Demonstrate its use in a breadth-first search scenario.

data-structurequeuefifodartbfs
View Details →CodeResources

What will be the output of the following dart code? implements vs extends — difference between using it in class constructors and methods

dartoopsextendsimplementsinheritance

How to remove the duplicate items in the list without using any built in methods like (contains, toSet(), where, indexOf) in flutter with some proper examples

dartdsalistduplicatesalgorithm

Hard Questions (4)

#419HardDSA

Implement the Quick Sort algorithm in Dart. Explain the partitioning logic and time complexity. What is the worst-case scenario?

algorithmsortingquick-sortdivide-conquerdart
View Details →CodeResources
#422HardDSA

Explain how Dart's Map works internally. How does it handle collisions? What is the time complexity of get/set operations?

data-structurehash-maphash-tabledartcollision
View Details →CodeResources
#423HardDSA

Implement a singly linked list in Dart with operations: insert at beginning, insert at end, delete by value, and reverse the list.

data-structurelinked-listdartreversenode
View Details →CodeResources
#424HardDSA

Implement a binary tree in Dart and write functions for: (a) In-order traversal, (b) Pre-order traversal, (c) Post-order traversal, (d) Level-order traversal (BFS).

data-structurebinary-treetree-traversaldartdfs
View Details →CodeResources