100 articles  ·  page 9 of 23

2559. Count Vowel Strings in Ranges

You are given a 0-indexed array of strings words and a 2D array of integers queries. …

1030. Matrix Cells in Distance Order

You are given four integers row, cols, rCenter, and cCenter. There is a rows x cols&n…

Maximum Score After Splitting a String

C++ Solution class Solution { public: int maxScore(string s) { int ones = count(s.begin(), s.end(), '1'); // T…

90% of CS graduates can't figure this out

Someone important on X posted: https://x.com/vikhyatk/status/1873033432705712304 i have a very simple question…

Count Ways To Build Good Strings

Given the integers zero, one, low, and high, we can construct a string by starting with an…

Custom Dockerfile for PHP 5.6 / Apache / WPCLI

I wanted to get my old wordpress 3.4 websites running again, so I had to build a couple docker images, and a d…

Set Matrix Zeros

class Solution { public: void setMatrixZeroes(vector<vector<int>> &mat) { int n = mat.size(); int m …

Zigzag string conversion solution in C++

The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this Input: s = "PAY…

Search Sorted Matrix Solution in C++

The idea here is to implement binary search after discovering the correct row. #include <bits/stdc++.h> usi…

LeetCode 543 Diameter of a Binary Tree in C++

Given the root of a binary tree, return the length of the diameter of the tree. The&n…

401. Binary Watch

A binary watch has 4 LEDs on the top to represent the hours (0-11), and 6 LEDs on the bottom to represent&nbsp…

Letter Combinations of a phone number

Given a string containing digits from 2-9 inclusive, return all possible letter combinations that th…