# Problem Solving

## Validating Postal Codes

Problem Statement The task is to write a function that validates whether a given postal code string meets certain conditions such as being a six-digit number with specific digits at specific positions and having a certain sum of digits. Link: HackerRank Complexity: Hard Solution: The solution to this problem involves the use of regular expressions. We define …

## Maximize It!

Problem Statement You are given a list of K lists, each of which contains N positive integers. You need to pick one number from each list such that the sum of the chosen numbers is less than or equal to a given integer M. Find the maximum possible value of the sum of the chosen …

## Human Traffic of Stadium (SQL #601)

This task requires to find Human Traffic of Stadium. We need to write a SQL query to extract records with three or more consecutive rows that have an ID and people count greater than or equal to 100. The resulting table should be sorted in ascending order by visit_date. Problem Statement Link: LeetCode Complexity: Hard Table: Stadium +—————+———+ …

## Department Top Three Salaries (SQL #185)

The task is to write an SQL query that will retrieve the employees who have the top three highest salaries in each department of a company, based on their unique salaries. The query should return the name of the employee, their department, and their salary. The output can be in any order. Problem Statement Link: LeetCode …

## Binary Search (#704)

Problem Statement Link: LeetCode Complexity: Easy Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its index. Otherwise, return -1. You must write an algorithm with O(log n) runtime complexity. Example 1: Input: nums = [-1,0,3,5,9,12], target = 9 Output: 4 Explanation: 9 exists in nums and its …

## Median of Two Sorted Arrays

Problem Statement Link: LeetCode Complexity: Hard 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)). Example 1: Input: nums1 = [1,3], nums2 =  Output: 2.00000 Explanation: merged array = [1,2,3] and median is 2. Example 2: Input: nums1 = [1,2], nums2 = [3,4] Output: …

Scroll to Top