acederberg.io
  • Home
  • Projects
    • Projects
    • Blog
    • Nvim Configuration
    • Blog and Demo Automation
    • Captura
  • Resume
  • Posts
  • Kaggle
  • Leetcode
  1. Projects
  2. Blog
  3. Subprojects
  4. Leetcode Problems
  • Projects
    • Blog
      • About the Blog
      • Subprojects
        • Resume
        • Building A Custom Iconset for Kubernetes
        • Leetcode Problems
      • Technical Details
        • Blog ReadMe
        • Docker and Quarto
        • How is the Blog Deployed?
        • Static Quarto Websites in Kubernetes
      • Components and Filters
        • IFrames
          • Demo
          • Docs: Pandoc Filter
        • Overlay
          • Demo
          • Docs: Pandoc Filter
          • Docs: Javascript
        • Floaty
          • Demo: Overview
          • Demo: Skills
          • Demo: Contacts
          • Demo: Links
          • Demo: Under Construction
          • Docs: Pandoc Filter
          • Docs: Javascript
        • Resume
          • Demo
          • Docs: Pandoc Filter
    • Nvim Configuration
      • Nvim Configuration
      • Gallery
    • Blog and Demo Automation
      • Automation
      • Github Actions in Automation
    • Captura
      • What is Captura?
      • Things I Plan to Build Using Captura

On this page

  • What is Leetcode?
  • Why Even Keep Notes About Leetcode Problems?
  • My Solutions
  1. Projects
  2. Blog
  3. Subprojects
  4. Leetcode Problems

Leetcode Problems

Here I have my solutions to many leetcode problems that I solve to practice and learn more about data structures and algorithms.

Author

Adrian Cederberg

Keywords

acederberg, datastructures, algorithms, leetcode, interview

What is Leetcode?

Leetcode is a platform for data structures and algorithms problem solving competitions. When a solution is submitted, it is run against many test cases and data on runtime and memory usage are collected. Competitors can see how their solutions ranked in runtime and memory as compared to all submitted solutions.

Why Even Keep Notes About Leetcode Problems?

Data structures and algorithms is an essential problem in computer science and I find them to be quite fun. I wanted to keep notes on the problems I solve because I have always found that taking notes has allowed me to fully analyze a problem. I also think that much of the work in solving these problems is in the analysis.

Few people sit down and immediately understand what they are going to implement without some planning and analysis. In fact, I would argue that it is bad practice to not consider the solution before implementation.

On top of this, there are a few more reasons worth listing here:

  1. I like to edit in vim, and writing out my code in vim is preferable,
  2. As I improve, I can come back and look at my solutions and analyses to improve (analyzing my analysis - meta-analysis),
  3. All solutions are tested and it is easy to setup pytest cases for each problem to avoid having to work in leetcode’s editor.

My Solutions

Daily Challenge 10/11/2024: The Number of the Smallest Unoccupied Chair
Party seating simulation.
Adrian Cederberg
Oct 11, 2024

Daily Challenge 10/10/2024: Maximum Ramp Width
Find the largest difference between two indices with increasing value in their corresponding array values.
Adrian Cederberg
Oct 10, 2024

Daily Challenge 10/09/2024: Minimum Add to Make Parenthesis Valid
Determine the number of parenthesis that need to be added to a string to close all pairs.
Adrian Cederberg
Oct 9, 2024

Daily Challenge 10/08/2024: Minimum Number of Swaps to Make the String Balanced
Compute the number of moves to balance a string of brackets.
Adrian Cederberg
Oct 8, 2024

Daily Challenge 10/07/2024: Minimum String Length After Removing Substrings
Remove nested substrings from a string.
Adrian Cederberg
Oct 7, 2024

Daily Problem 10/04/2024: Divide Players Into Teams of Equal Skill.
Divide an array into distinct pairs of equal sum.
Adrian Cederberg
Oct 4, 2024

Daily Problem 10/03/2024: Make Sum Divisible by p
Find a maximal subarray of an integer array whose modulus by p is 0.
Adrian Cederberg
Oct 3, 2024

Daily Problem 10/02/2024: Rank Transform of an Array

Given an array, turn its elements into their respective indices in the sorted version of the array.

Adrian Cederberg
Oct 2, 2024

Daily Challenge 09/30/2024: Design a Stack With Increment Operation.

Design a stack that supports increment operations on its elements.

Adrian Cederberg
Sep 30, 2024

Daily Challenge 09/26/2024: Calendar 1.
Implement a calendar using a class.
Adrian Cederberg
Sep 26, 2024

Daily Question 09/25/2024: Sum of Prefix Scores of Strings
Use a trie to count the number of occurrences of a prefix in a list.
Adrian Cederberg
Sep 25, 2024

Daily Question 9/24/2024: Longest Common Prefix.
Use a trie to find the longest common prefix shared by elements in the product of two arrays.
Adrian Cederberg
Sep 24, 2024

Daily Challenge 09/23/2024: Extra Characters in String
Dynamic programming
Adrian Cederberg
Sep 23, 2024

Palindrome Completion
Completing a string to a palindrome with the minimal number of characters.
Adrian Cederberg
Sep 23, 2024

Binary Tree In-Order Traversal
Traverse a binary tree in in-order order.
Adrian Cederberg
Sep 18, 2024

Determine if a Binary Tree is Balanced.
Determine if a binary tree is balanced.
Adrian Cederberg
Sep 18, 2024

Binary Search Tree from Descriptions
Create a binary tree from descriptions.
Adrian Cederberg
Sep 17, 2024

Length of Longest Substring

Find the longest non-repeating substring of an input string.

Adrian Cederberg
Sep 17, 2024

Uncommon Words from Two Sentences
Given two sentences, find the words that occur only once.
Adrian Cederberg
Sep 17, 2024

Delete Node from Linked List
Delete nodes from a linked list with certain values.
Adrian Cederberg
Sep 16, 2024

Median of Two Sorted Arrays
Finding the median value of two sorted arrays.
Adrian Cederberg
Sep 16, 2024

Minimum Time Difference

Given an array of HH:MM times, find the least difference.

Adrian Cederberg
Sep 16, 2024

Two Sum

Given an array, find two numbers that add up to a target number and return their indices.

Adrian Cederberg
Sep 16, 2024

Zigzag
Efficiently solving the zigzagification of a string.
Adrian Cederberg
Sep 16, 2024
No matching items
    Building A Custom Iconset for Kubernetes
    Blog ReadMe