Saturday, May 3, 2025

DATA STRUCTURE PRACTICAL QUESTIONS

Problem Statement: 

1- Given a circular array (where the end connects to the beginning), find the maximum possible sum of a non-empty subarray. (using Kadanes Algorithm)

2- Given a 2D matrix of integers, find the maximum sum submatrix.

3. Write a function to reverse a singly linked list.

4. Write a function to insert a value into a Binary Search Tree (BST) and return the updated root. (

5. Write a function to find the kth largest element in an array using a min-heap.

6. Write a function to perform Breadth-First Search (BFS) on a graph to find if a path exists between two nodes

7. Write a function to find the first non-repeating character in a string.

8. . Sliding Window Maximum (Using deque)

Problem: Given an array of integers nums and an integer k, find the maximum element in each sliding window of size k as the window moves from left to right. Return a list of these maximums.


9. Group Anagrams (Using defaultdict)

Problem: Given an array of strings strs, group the anagrams together. An anagram is a word formed by rearranging the letters of another word, using all the original letters exactly once. Return the grouped anagrams as a list of lists.

10. Top K Frequent Elements (Using Counter)

Problem: Given an array of integers nums and an integer k, return the k most frequent elements in any order.





No comments:

Post a Comment