An open API service indexing awesome lists of open source software.

https://github.com/shivam-kumar-59/30-days-coding-challenge

The 30DaysCodingChallenge is an exciting coding initiative launched by USCKIIT aimed at boosting the problem-solving skills and programming proficiency of participants. This challenge encourages consistent daily practice by solving three problems each day from any coding platform,using one of the chosen programming languages: C,C++, Java, or Python
https://github.com/shivam-kumar-59/30-days-coding-challenge

Last synced: 3 months ago
JSON representation

The 30DaysCodingChallenge is an exciting coding initiative launched by USCKIIT aimed at boosting the problem-solving skills and programming proficiency of participants. This challenge encourages consistent daily practice by solving three problems each day from any coding platform,using one of the chosen programming languages: C,C++, Java, or Python

Awesome Lists containing this project

README

        

30 Days-Coding-Challenge



Overview


The 30-Days-Coding-Challenge is an initiative launched by USCKIIT to encourage coding practice and skill enhancement. Participants are required to solve 3 problems each day from their choice of coding platforms using any one of the following languages: C, C++, Java, or Python.


  • Start Date: 15th June

  • End Date: 14th July




Objectives



  • Improve problem-solving skills

  • Enhance coding proficiency in selected languages

  • Foster consistency and discipline in daily coding practice


Participation Guidelines




  • Daily Tasks: Solve 3 problems of your choice each day.


  • Languages: Choose from C, C++, Java, or Python.


  • Platforms: You are free to select problems from any coding platform (e.g., LeetCode, HackerRank, CodeChef, etc.).


Questions Done



  • Day - 1 LinkedIn Post



    1. 1672. Richest Customer Wealth ( Easy )

    2. You are given an m x n integer grid accounts where accounts[i][j] is the amount of money the i​​​​​​​​​​​th​​​​ customer has in the j​​​​​​​​​​​th​​​​ bank. Return the wealth that the richest
      customer has.
      A customer's wealth is the amount of money they have in all their bank accounts. The richest customer is the customer that has the maximum wealth.

    3. 1295. Find Numbers with Even Number of Digits ( Easy )

    4. Given an array nums of integers, return how many of them contain an even number of digits.
    5. 5. Search Insert Position ( Easy )

    6. Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted
      in order.
      You must write an algorithm with O(log n) runtime complexity.




  • Day - 2 LinkedIn Post


    1. 15. 3Sum ( Medium )

    2. Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.
      Notice that the solution set must not contain duplicate triplets.

    3. 33. Search in Rotated Sorted Array ( Medium )

    4. There is an integer array nums sorted in ascending order (with distinct values).
      Prior to being passed to your function, nums is possibly rotated at an unknown pivot index such that the resulting array is [nums[k], nums[k+1], ..., nums[n-1],
      nums[0], nums[1], ..., nums[k-1]] (0-indexed). For example, [0,1,2,4,5,6,7] might be rotated at pivot index 3 and become [4,5,6,7,0,1,2].
      Given the array nums after the possible rotation and an integer target, return the index of target if it is in nums, or -1 if it is not in nums.
      You must write an algorithm with O(log n) runtime complexity.
    5. 1095. Find in Mountain Array ( Hard )

    6. You may recall that an array arr is a mountain array if and only if:

      • arr.length >= 3

      • There exists some i with 0 < i < arr.length - 1 such that:

        • arr[0] < arr[1] < ... < arr[i - 1] < arr[i]

        • arr[i] > arr[i + 1] > ... > arr[arr.length - 1]



      • Given a mountain array mountainArr, return the minimum index such that mountainArr.get(index) == target. If such an index does not exist, return -1. You cannot access the mountain array directly. You may only access the array using a MountainArray interface:
        MountainArray.get(k) returns the element of the array at index k (0-indexed).
        MountainArray.length() returns the length of the array.
        Submissions making more than 100 calls to MountainArray.get will be judged Wrong Answer. Also, any solutions that attempt to circumvent the judge will result in disqualification




  • Day - 3 LinkedIn Post



    1. 794. Valid Tic-Tac-Toe State ( Medium )

    2. Given a Tic-Tac-Toe board as a string array board, return true if and only if it is possible to reach this board position during the course of a valid tic-tac-toe game.
      The board is a 3 x 3 array that consists of characters ' ', 'X', and 'O'. The ' ' character represents an empty square.

    3. 48. Rotate Image ( Medium )

    4. You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise).
      You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. DO NOT allocate another 2D matrix and do the rotation.
    5. 240. Search a 2D Matrix II ( Medium )

    6. Write an efficient algorithm that searches for a value target in an m x n integer matrix matrix. This matrix has the following properties:
      Integers in each row are sorted in ascending from left to right.
      Integers in each column are sorted in ascending from top to bottom.



  • Day - 4 LinkedIn Post



    1. 17. Letter Combinations of a Phone Number ( Medium )

    2. Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order.
      A mapping of digits to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters.

    3. 165. Compare Version Numbers ( Medium )

    4. Given two version strings, version1 and version2, compare them. A version string consists of revisions separated by dots '.'. The value of the revision is its integer conversion ignoring leading zeros.
      To compare version strings, compare their revision values in left-to-right order. If one of the version strings has fewer revisions, treat the missing revision values as 0.
      Return the following: 1. If version1 < version2, return -1
      2.If version1 > version2, return 1 3.Otherwise, return 0
    5. 345. Reverse Vowels of a String ( Easy )

    6. Given a string s, reverse only all the vowels in the string and return it.
      The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in both lower and upper cases, more than once.



  • Day - 5 LinkedIn Post



    1. 10. Regular Expression Matching ( Hard )

    2. Given an input string s and a pattern p, implement regular expression matching with support for '.' and '*' where:
      '.' Matches any single character.​​​​ '*' Matches zero or more of the preceding element. The matching should cover the entire input string (not partial).

    3. 443. String Compression ( Medium )

    4. Given an array of characters chars, compress it using the following algorithm:
      Begin with an empty string s. For each group of consecutive repeating characters in chars:
      If the group's length is 1, append the character to s.
      Otherwise, append the character followed by the group's length.
      The compressed string s should not be returned separately, but instead, be stored in the input character array chars. Note that group lengths that are 10 or longer will be split into multiple characters in chars.
      After you are done modifying the input array, return the new length of the array. You must write an algorithm that uses only constant extra space.
    5. 318. Maximum Product of Word Lengths ( Medium )

    6. Given a string array words, return the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. If no such two words exist, return 0.



  • Day - 6 LinkedIn Post



    1. 32. Longest Valid Parentheses ( Hard )

    2. Given a string containing just the characters '(' and ')', return the length of the longest valid (well-formed) parentheses

    3. 179. Largest Number ( Medium )

    4. Given a list of non-negative integers nums, arrange them such that they form the largest number and return it. Since the result may be very large, so you need to return a string instead of an integer.
    5. 539. Minimum Time Difeference ( Medium )

    6. Given a list of 24-hour clock time points in "HH:MM" format, return the minimum minutes difference between any two time-points in the list.



  • Day - 7 LinkedIn Post



    1. 4. Median of Two Sorted Arrays ( Hard )

    2. Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).

    3. 41. First Missing Positive ( Hard )

    4. Given an unsorted integer array nums. Return the smallest positive integer that is not present in nums. You must implement an algorithm that runs in O(n) time and uses O(1) auxiliary space.
    5. 123. Best Time to Buy and Sell Stock III ( Hard )

    6. You are given an array prices where prices[i] is the price of a given stock on the ith day. Find the maximum profit you can achieve. You may complete at most two transactions. Note: You may not engage in multiple transactions simultaneously (i.e., you must sell the stock before you buy again).



  • Day - 8 LinkedIn Post



    1. 1. Find the first and last occurrence of a given number in a sorted array.

    2. The first occurrence of a number is when it first appears in a list or array and the last occurrence is when it appears for the last time in a list or array.
      Eg: Input: [8, 3, 6, 9, 5, 10, 2, 5, 3], number: 3 Output: 1, 8

    3. 2. Factorial of a non-negative integer

    4. Factorial of a non-negative integer is the multiplication of all positive integers smaller than or equal to n. It is denoted by the sign '!'.
      Eg: factorial of 5 or 5! is 5*4*3*2*1 which is 120.
    5. 3. Nth Fibonacci number

    6. The Fibonacci numbers are the numbers in the following integer sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, …….. .
      Print the nth fibonacci number.
      Eg: Input: 9 Output: 34



  • Day - 9 LinkedIn Post



    1. 1. Write a program to find the majority element from a list of given elements.

    2. The element having frequency more than N/2 is a majority element , where N is the total number of elements present
      Eg: Input: [2,2,1,1,2,2] Output: 2

    3. 2. Write a program to sort the colors based on the code given:

    4. Red -> 0, Green -> 1, Blue -> 2
      Eg: Input: [1,1,0,2,0,2] Output: [0,0,1,1,2,2]
    5. Write a program to count the number of inversions possible in an array.

    6. Inversion occurs when i < j and a[i] > a[j], where 'i' and 'j' are the index numbers of present and next element respectively, and 'a' represents array
      Eg: Input: [70,50,60,10,20,30,80,15] Output: 17



  • Day - 10 LinkedIn Post



    1. 1. Binary Strings Problem

    2. Print all binary stringd of size 'N' without consecutive ones

    3. 2. Remove Duplicates

    4. Remove duplicates from a sorted array in-place such that each element appears only once and returns the new string ( The string only consists of smallcase alphabets i.e. from 'a' to 'z' )
    5. 3. Tiling Problem

    6. Given a ' 2 x n ' board and tiles of size ' 2 x 1 ', count the number of ways to tile the given board using ' 2 x 1 ' tiles. ( A tile can be placed horizontally or vertically )



  • Day - 11 LinkedIn Post



    1. 1. Merge Sort using Recursion.

    2. Merge sort is a sorting algorithm that follows the divide-and-conquer approach. It works by recursively dividing the input array into smaller subarrays and sorting those subarrays then merging them back together to obtain the sorted array.
      Time Complexity: O(n log n)

    3. 2. Quick Sort using Recursion.

    4. QuickSort is a sorting algorithm based on the Divide and Conquer algorithm that picks an element as a pivot and partitions the given array around the picked pivot by placing the pivot in its correct position in the sorted array.
      Time Complexity: O(n log n).
    5. 3. Search in Rotated Sorted Array ( Medium ).

    6. There is an integer array nums sorted in ascending order (with distinct values). Prior to being passed to your function, nums is possibly rotated at an unknown pivot index k (1 <= k < nums.length) such that the resulting array is [nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nums[k-1]] (0-indexed). For example, [0,1,2,4,5,6,7] might be rotated at pivot index 3 and become [4,5,6,7,0,1,2]. Given the array nums after the possible rotation and an integer target, return the index of target if it is in nums, or -1 if it is not in nums. You must write an algorithm with O(log n) runtime complexity.



  • Day - 12 LinkedIn Post



    1. 1. UTF-8 Validation ( Medium )

    2. Given an integer array data representing the data, return whether it is a valid UTF-8 encoding (i.e. it translates to a sequence of valid UTF-8 encoded characters). A character in UTF8 can be from 1 to 4 bytes long, subjected to the following rules: For a 1-byte character, the first bit is a 0, followed by its Unicode code. For an n-bytes character, the first n bits are all one's, the n + 1 bit is 0, followed by n - 1 bytes with the most significant 2 bits being 10.

    3. 2. Divide Two Integers ( Medium )

    4. Given two integers dividend and divisor, divide two integers without using multiplication, division, and mod operator. The integer division should truncate toward zero, which means losing its fractional part. For example, 8.345 would be truncated to 8, and -2.7335 would be truncated to -2. Return the quotient after dividing dividend by divisor. Note: Assume we are dealing with an environment that could only store integers within the 32-bit signed integer range: [−231, 231 − 1]. For this problem, if the quotient is strictly greater than 231 - 1, then return 231 - 1, and if the quotient is strictly less than -231, then return -231.
    5. 3. Bitwise AND of Numbers Range ( Medium )

    6. Given two integers left and right that represent the range [left, right], return the bitwise AND of all numbers in this range, inclusive.



  • Day - 13 LinkedIn Post



    1. 1. N-Queens ( Hard )

    2. The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other. Given an integer n, return all distinct solutions to the n-queens puzzle. You may return the answer in any order. Each solution contains a distinct board configuration of the n-queens' placement, where 'Q' and '.' both indicate a queen and an empty space, respectively.

    3. 2. Sudoku Solver ( Hard ).

    4. Write a program to solve a Sudoku puzzle by filling the empty cells. A sudoku solution must satisfy all of the following rules: Each of the digits 1-9 must occur exactly once in each row. Each of the digits 1-9 must occur exactly once in each column. Each of the digits 1-9 must occur exactly once in each of the 9 3x3 sub-boxes of the grid. The '.' character indicates empty cells.
    5. 3. Subsets ( Medium ).

    6. Given an integer array nums of unique elements, return all possible subsets (the power set). The solution set must not contain duplicate subsets. Return the solution in any order.



  • Day - 14 LinkedIn Post



    1. 1. Insert and Delete the first Node

    2. Given a Singly Linked List insert and delete the first node from the Linked List and return the List.

    3. 2. Insert and Delete the last Node

    4. Given a Singly Linked List insert and delete the last node from the Linked List and return the List.
    5. 3. Insert and Delete a Node at any given position

    6. Given a Singly Linked List insert the given value at the given index and delete the node present on the given index from the Linked List and return the List.



  • Day - 15 LinkedIn Post



    1. 1. Linked List Cycle

    2. Write a function to determine if a linked list has a cycle using two pointer technique. If the cycle is detected, the function should return the node where the cycle begins. Otherwise, it should return None.

    3. 2. Unique BST

    4. Given an integer n write a function to determine how many unique Binary Search Tree can be constructed using n nodes.
    5. 3. Adjaceny List

    6. Write a function to determine a undirected graph is connected. The graph is represented using an adjacency list.



  • Day - 16 LinkedIn Post



    1. 1. Given a Node and it's value, insert it :
      (i) At the first place.
      (ii) At the last place.
      (iii) After a given value of the node.


    2. 2. Given a Linked List display its nodes and thei values in reverse order.

    3. 3. Given a Circular Linked List delete a node whose value is given.




  • Day - 17 LinkedIn Post



    1. Insert a given node and its value in the given index using recursion.



    2. 2. Remove Duplicates from Sorted List ( Easy ).

      Given the head of a sorted linked list, delete all duplicates such that each element appears only once. Return the linked list sorted as well.


    3. 3. Merge Two Sorted Lists ( Easy ).

      You are given the heads of two sorted linked lists list1 and list2. Merge the two lists into one sorted list. The list should be made by splicing together the nodes of the first two lists. Return the head of the merged linked list.




  • Day - 18 LinkedIn Post




    1. 1. Sort List ( Medium ).

      Given the head of a linked list, return the list after sorting it in ascending order.


    2. 2. Happy Number ( Easy ).
      Write an algorithm to determine if a number n is happy. A happy number is a number defined by the following process: Starting with any positive integer replace the number by the sum of the squares of its digits. Repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy. Return true if n is a happy number, and false if not.


    3. 3. Middle of the Linked List ( Medium ).
      Given the head of a singly linked list, return the middle node of the linked list. If there are two middle nodes, return the second middle node..




  • Day - 19 LinkedIn Post




    1. 1. Reverse Linked List ( Easy ).

      Given the head of a singly linked list, reverse the list, and return the reversed list.


    2. 2. Reverse Linked List II ( Medium ).
      Given the head of a singly linked list and two integers left and right where left <= right, reverse the nodes of the list from position left to position right, and return the reversed list.


    3. 3. Palindrome Linked List ( Easy ).
      Given the head of a singly linked list, return true if it is a palindrome
      or false otherwise.




  • Day - 20 LinkedIn Post



    1. 1.Reorder List ( Medium ).

    2. You are given the head of a singly linked-list. The list can be represented as: L0 → L1 → … → Ln - 1 → Ln Reorder the list to be on the following form: L0 → Ln → L1 → Ln - 1 → L2 → Ln - 2 → … You may not modify the values in the list's nodes. Only nodes themselves may be changed.

    3. 2. Reverse Nodes in k-Group ( Hard ).

    4. Given the head of a linked list, reverse the nodes of the list k at a time, and return the modified list. k is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a multiple of k then left-out nodes, in the end, should remain as it is. You may not alter the values in the list's nodes, only nodes themselves may be changed.
    5. 3. Rotate List ( Medium ).

    6. Given the head of a linked list, rotate the list to the right by k places.



  • Day - 21 LinkedIn Post



    1. 1 Implement Queue using Stacks ( Easy ).

    2. Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (push, peek, pop, and empty). Implement the MyQueue class: void push(int x) Pushes element x to the back of the queue. int pop() Removes the element from the front of the queue and returns it. int peek() Returns the element at the front of the queue. boolean empty() Returns true if the queue is empty, false otherwise.

    3. 2. Valid Parentheses ( Easy ).

    4. Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: Open brackets must be closed by the same type of brackets. Open brackets must be closed in the correct order. Every close bracket has a corresponding open bracket of the same type.
    5. 3. Minimum Add to Make Parentheses Valid ( Medium ).

    6. A parentheses string is valid if and only if: It is the empty string, It can be written as AB (A concatenated with B), where A and B are valid strings, or It can be written as (A), where A is a valid string. You are given a parentheses string s. In one move, you can insert a parenthesis at any position of the string.



  • Day - 22 LinkedIn Post




    1. 1. GPS Navigation.

      You are working on a sophisticated GPS navigation system that calculates the fastest route in the city . The city is represented by a graph where intersections are nodes and roads between them are edges with travel times. Develop a function that determines the shortest travel from a given starting intersection to all the other intersections in the city.


    2. 2. Data Compression.
      You are working on a data compression project and need to minimize the space required to store a set of characters and their frequencies. One of your colleagues suggests using a tree-based approach to encode the characters efficiently. To evaluate this idea, you decide to implement a system that: 1. Reads a set of characters along with their frequencies. 2. Constructs an optimal binary tree based or tliese frequencies. 3. Generates binary codes for each character. Your task is to write a function that takes a list of characters and their corresponding frequencies, constructs the optimal tree, and returns a dictionary with characters as keys and their binary codes as values.


    3. 3. Vehicle Loading.
      You are working on a logistics optimization system for a large-scale transportation company. The company needs to maximize the value of items transported in its fleet of vehicles, each with a different weight capacity. Each item has a specific weight and value, and some items may have-dependencies, meaning certain items must be included if another item is selected. Write a function that determines the optimal selection of items to maximize their total value while staying within the given weight capacities of multiple vehicles and respecting the dependencies between items.




  • Day - 23 LinkedIn Post




    1. 1. Insert Node.

      Write a function to Insert nodes in a Binary Tree and a Binary Search Tree.


    2. 2. Write a function to check whether a given tree is balanced or not.
      Balanced tree is a tree in which the difference between the height of left and right subtrees is not more than one for all nodes.


    3. 3. Write a funtcion to perform Pre - Order, In - Order and Post- Order Traversals in a given Binary Tree.




  • Day - 24 LinkedIn Post




    1. 1. Insert in AVL.

      Write a function to Insert nodes in an AVLTree.
      An AVL tree defined as a self-balancing Binary Search Tree (BST) where the difference between heights of left and right subtrees for any node cannot be more than one.


    2. Construct a Segment Tree.
      Write a function to construct a Segment Tree.
      Segment Tree is a versatile data structure that allows efficient querying and updating of intervals or segments of an array. It is particularly useful for problems involving range queries, such as finding the sum, minimum, maximum, or any other operation over a specific range of elements in an array.


    3. Update Segment Tree

      Write a Function to Update a given node in a Segment Tree.




  • Day - 25 LinkedIn Post




    1. 1. Binary Tree Level Order Traversal ( Medium ).

      Given the root of a binary tree, return the level order traversal of its nodes' values. (i.e., from left to right, level by level).


    2. 2. Average of Levels in Binary Tree ( Easy ).

      Given the root of a binary tree, return the average value of the nodes on each level in the form of an array. Answers within 10-5 of the actual answer will be accepted.


    3. 3. Level Order Successor of a Node.

      Given a binary tree and a node in the binary tree, find Levelorder successor of the given node. That is, the node that appears after the given node in the level order traversal of the tree.




  • Day - 26 LinkedIn Post



    1. 1. Binary Tree Zigzag Level Order Traversal ( Medium ).

    2. Given the root of a binary tree, return the zigzag level order traversal of its nodes' values. (i.e., from left to right, then right to left for the next level and alternate between).

    3. 2. Binary Tree Level Order Traversal II ( Medium ).

    4. Given the root of a binary tree, return the bottom-up level order traversal of its nodes' values. (i.e., from left to right, level by level from leaf to root).
    5. 3. Populating Next Right Pointers in Each Node ( Medium ).

    6. You are given a perfect binary tree where all leaves are on the same level, and every parent has two children. The binary tree has the following definition: struct Node { int val; Node *left; Node *right; Node *next; } Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to NULL. Initially, all next pointers are set to NULL.



  • Day - 27 LinkedIn Post




    1. 1. Binary Tree Right Side View ( Medium ).

      Given the root of a binary tree, imagine yourself standing on the right side
      of it, return the values of the nodes you can see ordered from top to bottom.


    2. 2. Cousins in Binary Tree ( Easy ).

      Given the root of a binary tree with unique values and the values of two different nodes of the tree x and y, return true if the nodes corresponding to the values x and y in the tree are cousins, or false otherwise. Two nodes of a binary tree are cousins if they have the same depth with different parents. Note that in a binary tree, the root node is at the depth 0, and children of each depth k node are at the depth k + 1.


    3. 3. Symmetric Tree ( Easy ).

      Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center).




  • Day - 26 LinkedIn Post



    1. 1. Flatten Binary Tree to Linked List ( Medium ).

    2. Given the root of a binary tree, flatten the tree into a "linked list": The
      "linked list" should use the same TreeNode class where the right child
      pointer points to the next node in the list and the left child pointer is
      always null. The "linked list" should be in the same order as a pre-order
      traversal of the binary tree.

    3. 2. Lowest Common Ancestor of a Binary Tree ( Medium ).

    4. Given a binary tree, find the lowest common ancestor (LCA) of two given nodes
      in the tree. According to the definition of LCA on Wikipedia: “The lowest
      common ancestor is defined between two nodes p and q as the lowest node in T
      that has both p and q as descendants (where we allow a node to be a
      descendant of itself).”
    5. 3. Validate Binary Search Tree ( Medium ).

    6. Given the root of a binary tree, determine if it is a valid binary search
      tree (BST). A valid BST is defined as follows: The left subtree of a node
      contains only nodes with keys less than the node's key. The right subtree of
      a node contains only nodes with keys greater than the node's key. Both the
      left and right subtrees must also be binary search trees.



  • Day - 15 LinkedIn Post



    1. 1. Unique Path

    2. You are given a grid with dimensions n x m, where each cell in the grid is either free (0) or has an obstacle (1). You need to find the number of unique paths from the top-left corner (0,0) to the bottom-right corner (n-1,m-1) of the grid. You can only move either down or right at any point in time, and you cannot move through obstacles.
      Ex:
      Input grid = [[0,0,0], [0,1,0], [0,0,0]] , n = 3, m = 3
      Output = 2

    3. 2. Count Substring

    4. You are given a string s consisting of lowercase English letters. Your task is to count the number of distinct non-empty subsequences of s. A subsequence of a string is obtained by deleting zero or more characters from the string without changing the order of the remaining characters.
      Ex:
      Input: s = "abc"
      Output: 7
    5. 3. Minimum Substring

    6. You are given two strings, s (the "source" string) and t (the "target" string). Your task is to find the minimum window in s which contains all characters from t in any order. If there is no such window in s that covers all characters in t, return an empty string "".
      Ex:
      Input: s = "ADOBECODEBANC", t = "ABC"
      Output: "BANC"



  • Day - 30 LinkedIn Post



    1. 1. Tree

    2. Design an algorithm to serialize and deserialize a binary tree. Serialization is the process of converting a tree to a string representation, and deserialization is the process of converting the string back to the original tree structure.

    3. 2. Trading

    4. Design an automated trading system for a financial institution to buy and sell financial instruments across exchanges. The system must process real-time market data, execute trades using algorithms, manage risk and compliance, and monitor performance.
      1. Data Handling and Analysis: Acquire and analyze real-time market data to identify trading opportunities.
      2. Trading Execution: Automatically execute orders through exchange APIs based on algorithmic decisions.
      3. Risk Management and Compliance: Implement controls to manage risk exposure and ensure regulatory compliance.
      4. Performance Monitoring: Track metrics and generate reports on profitability and risk exposure
    5. 3. Manufacturing

    6. A manufacturing company has a production line with several workstations processing batches of raw materials. Each workstation operates in discrete time steps, processing, remaining idle, or passing batches to the next workstation. Workstations have limited capacities and aim to optimize throughput while minimizing downtime and bottlenecks.
      Requirements: 1. Track workstation status (processing, idle, passing) at each time step.
      2. Manage dynamic changes: add/remove workstations, change capacities, vary batch arrival rates.
      3. Simulate the production line over a specified period, providing statistics on throughput, idle tim