Skip to content

Instantly share code, notes, and snippets.

View evolvingsam's full-sized avatar

Alawode Samuel Ayobami evolvingsam

View GitHub Profile

Question

Approach

My approach involves first checking if the two strings, s1 and s2, are equal. If they are, we immediately return true since no swap is needed.

Next, I create a list(array) called diff to store, in a tuple, the characters at a particular index if they are different. Since I can only make one swap, if the length of my diff list is greater than 2 mid way in the loop, then I return false.

  • At the end of the loop, If the length of diff is 2 and the first tuple is the reverse of the second tuple in my diff list, then I'll return True, otherwise, I'll return False.

Implementation

Modular Python Ingestion Pipeline

High-Level Architecture

graph TD
    User[Main / Scheduler] -->|Job Payload| Engine[Ingestion Engine]
    
    subgraph Core Logic
    Engine -->|Check Limit| RateLimiter[Rate Limiter]
 Engine -->|Request Class| Registry[Connector Registry]
@evolvingsam
evolvingsam / main.md
Created January 1, 2026 01:07
Leetcode 2026 Day 1

Question

Approach

This is like a basic maths, I traversed the list and added the correct place value of subsequent digits to the previous ones, making the initial digit the 1 that should be added to the whole digits.

I got the place value by raising 10 to the power of (the length of the list − 1 − the index).

Then, I built a list from the resulting total digits and returned it.