Skip to content

Instantly share code, notes, and snippets.

PROBLEM 10: Longest Substring with At Most K Distinct Characters

Problem Statement

Given a string s and an integer k, return the length of the longest substring that contains at most k distinct characters.

Concepts Covered

  • Sliding Window
  • HashMap for Character Frequency
  • Edge Case Handling

PROBLEM 5: Container With Most Water

Problem Statement

Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai), n vertical lines are drawn. Find two lines that together with the x-axis forms a container, such that the container contains the most water.

Concepts Covered

  • Two Pointer Technique
  • Optimization

Examples

PROBLEM 4: Median of Two Sorted Arrays

Problem Statement

Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).

Concepts Covered

  • Binary Search
  • Divide and Conquer

Examples

PROBLEM 3: Merge Intervals

Problem Statement

Given an array of intervals where intervals[i] = [start_i, end_i], merge all overlapping intervals.

Concepts Covered

  • Sorting
  • Interval Merging

Examples

PROBLEM 2: Two Sum

Problem Statement

Given an array of integers nums and an integer target, return the indices of the two numbers such that they add up to target.

Concepts Covered

  • Hash Map
  • Brute Force Search

Examples

PROBLEM 1: Longest Substring Without Repeating Characters

Problem Statement

Given a string s, find the length of the longest substring without repeating characters.

Concepts Covered

  • Sliding Window
  • Hashing
  • Two Pointers

GUARDING

Security, Stability, and Guardrails for Autonomous Agent Behavior Target Use Case: Travel Agency Chatbot Agent


🧱 1. Input Validation & Sanitization

  • Validate all user inputs before processing.

🎯 EDGE-CASES.md

Should You Include Edge Cases Early in Fine-Tuning?

This doc helps you decide when and how to include edge cases or rare patterns in your fine-tuning dataset.


✅ Start With Consistency

🧹 DATA-SANITIZATION

Overview

Cleaning and validating your fine-tuning dataset is one of the most important steps to ensure effective model training. Poorly formatted or inconsistent data leads to degraded model quality, wasted GPU hours, and hard-to-debug behaviors.

This doc covers:

  • Common formatting pitfalls
  • Best practices
  • A sample validation script

📊 LANGSMITH.md

Overview

LangSmith (by LangChain) and LangFuse are powerful observability and analytics tools for LLM workflows. You can use them to track, analyze, and improve model performance — and even synthesize better training data using real user interactions.

This guide covers:

  • How to connect LangSmith or LangFuse
  • How to log successful Q&A pairs
  • How to use logged data for fine-tuning or RAG
  • Sample integration script