All Posts

Leetcode 215: Kth Largest Element in an Array

Given an array of integers, find the kth largest element without sorting the entire array.

Leetcode 347: Top K Frequent Elements

Given an integer array nums and an integer k, return the k most frequent elements from the array. The answer may be returned in any order.

Leetcode 355: Design Twitter

Design a simplified version of Twitter where users can post tweets, follow/unfollow other users, and view the most recent tweets in their news feed.

Leetcode 373: Find K Pairs with Smallest Sums

Given two sorted integer arrays nums1 and nums2 and an integer k, return the k pairs with the smallest sums. Each pair consists of one element from nums1 and one element from nums2.

Leetcode 378: Kth Smallest Element in a Sorted Matrix

Given an n x n matrix where each row and column is sorted in ascending order, find the kth smallest element in the matrix. The matrix is sorted in both rows and columns, but the kth smallest element is the one in the sorted order, not necessarily distinct.

Leetcode 451: Sort Characters By Frequency

Given a string, sort its characters based on their frequency of occurrence in descending order. If multiple solutions are possible, any valid answer is acceptable. The frequency of each character refers to how many times it appears in the string.