Skip to content

Instantly share code, notes, and snippets.

@northsamurai
northsamurai / ProductSuggestion.cs
Last active April 29, 2025 10:45
Product Suggestion
/*
* Problem: Product Suggestion System
*
* You’re implementing a product suggestion system for a shopping app.
* Given a list of product names and a search query string, return a list of suggestions
* after each character is typed, starting from the second character.
*
* Requirements:
* - Suggestions must match the current prefix (case-insensitive)
* - Sorted lexicographically
@northsamurai
northsamurai / OrderProcessor.cs
Created April 29, 2025 10:33
OrderProcessor
public class OrderProcessor
{
public void ProcessOrder(Order order)
{
Console.WriteLine("Processing order...");
// Validate order
if (order == null || order.Items == null || order.Items.Count == 0)
{
Console.WriteLine("Invalid order.");