Fading Coder

One Final Commit for the Last Sprint

LeetCode Weekly Contest 356 Solutions

Counting Employees Meeting Target Hours This problem requires counting employees whose work hours meet or exceed a target value. A simple linear scan suffices. class Solution { public: int numberOfEmployeesWhoMetTarget(vector<int>& hours, int target) { int count = 0; for (int h : hours) {...

Finding the Longest Substring Without Repeating Characters Using Sliding Windows

This article explores different approaches to finding the longest substring within a given string that contains no repeating characters. We'll examine implementations using C++ and illustrate the underlying logic. Sliding Window with unordered\_set The first approach utilizes a sliding window techni...

Reviewing Array and Linked List Fundamentals

This review focuses on core techniques for arrays and linked lists, including practical C++ implementations. Arrays The most important concept for array problems is the two-pointer technique. Fast and Slow Pointers When removing or manipulating elements, nested loops lead to O(n²) time complexity. U...

Maximize Gold Collection by Repositioning a 3-Wide Blocking Door

Single-width adjacent caves in a row each hold some gold coins. A fixed-width stone door, initially blocking three unspecified caves, can be shifted exactly once to cover any set of three consecutive caves. No cave can be accessed before shifting; after shifting, only unblocked caves are collectible...