harisrid Tech News

Spanning across many domains – data, systems, algorithms, and personal

  • TRAVEL – Exploring Mendocino in Two Days- a.k.a. how to do a weekend getaways

    A Primer

    Hi all,

    Today, I’ll detour on a different topic from the Amtrak trip journeys. Instead, I’m focusing on planning a two-day weekend getaway plan. Under discussion is Mendocino, California – a historical beach town located along the state’s Pacific Northwestern coast. Mendocino boasts an enumerable number of beautiful beaches, fascinating geographical features, and quaint small American towns. I was motivated to go here after hearing about the place from a few friends.

    The drive to Mendocino entailed 4-5 hours in between San Francisco and the small cities of Fort Bragg and Mendocino. I drove by myself and incorporated breaks to subdivide the trip : 15-30 minutes of hiking , 30-minutes for lunch, and 15-minutes to refill on gasoline and supplies. If I planned better, I would have left earlier from my home around 8:00 a.m. PST, but I was somewhat delayed and ended up leaving closer to 10:00 a.m. PST ( loosing a few hours of sunlight in the process ).

    Breakdown of the days

    On low-traffic days, it takes about 3.5-4 hours to drive in between San Francisco, CA and Mendocino, CA ( assuming no breaks for fuel or food )
    Between Bodega Bay and Mendocino lies the trip’s real meat – for 2.5 hours, you’ll drive along the precipitous drop of California’s coastal ranges plunging into to the Pacific.

    Day #1 : Friday, July 12th, 2024 – Gualala ( the town unknown ) and Fort Bragg

    I pride myself on my forward-thinking abilities, and I scope down sights of interest before hitting the road. I list about 5-6 sites but never hold myself to the absolutely unrealistic expectation that I’ll hit every listing ( sites may be closed due to natural disasters or human intervention). Hitting up three to four locations counts as a solid trip ( to me ! ).

    1. Glass Beach
    2. Coastal Trails and cliff sides
    3. Coves with steam releases
    4. Point Cabrillo Lighthouse
    5. Lighthouse museum and Lighthouse museum state park
    6. Black Sand Beach
    The pacific ocean’s crashing waves cutting through the jagged rocks of coastal Mendocino.

    And sometimes, I change the plan upon discovering better locations or pit stops that I didn’t know prior. I seem to learn more only when I get going on the trip!. I landed in Gualala, California – a beautiful mid-point stop that offers the biggest views into northwest California’s pacific ocean.

    Expansive views of California’s coastal Mediterranean chapparal – taken from Gualala, California
    Sourced from the beautiful beach town of Gualala, California – I didn’t know about it at the time, but I highly recommend stopping your vehicle here to take in the stunning ocean beach views
    The small beach houses of Gualala, California. I spent a break here to fill up on fuel and gather my senses.

    Day #2 : Saturday, July 13th, 2024 – Actual Mendocino

    Fortune had it that the small Californian beach towns of Fort Bragg and Mendocino lie only fife-teen minutes apart . On the second day’s visit, I quickly drove north from Mendocino to Fort Bragg. I set my sites to three locations of major interest : Pomo Bluff Park, Glass Beach, and Compass Ross. With the assistance of travel accouterments – lightweight aluminum poles and R.E.I all-terrain hiking boots – I descended down the rocky outcrops to the sandy beaches, where the lucid, clear waters bathed and cleansed my shoes. I then invoked the spirit of my inner child and thankfully-not-lost-to-the-world-yet sense of child-like awe. I picked up, played, and passed beach pebbles back into the Pacific’s sun-scintillated crystal-clear waters. I was having the time of my life here: a goddamn blast!

    Day one entailed an overnight stay in Mendocino; day two involved a brief visit to Fort Bragg.
    Glass Beach – notice broken glass strands scattered across the brown, sandy beach. The chipped pieces are remnants of a historical dumping ground which beautify and add character.
    Pomo Bluff Park – the ocean’s fury constantly chisels rocky outcrops, ensuring the replenishment of the beach’s sand.
    Sapphire-colored water cutting into a cove. Discovered somewhere on the Pacific Coast Highway ( PCH ) – a.k.a. the California 1. I walked atop the rocky outcrops, marveling at the state’s geography and geology.
  • TRAVEL – An Epic Coast-to-Coast Amtrak Journey : A Traveler’s Guide from America’s Sea to Shining Sea

    Are we seeing transcontinental energy here? Why coast-to-coast Hari?

    Ok so I previous talked about going on two Amtrak trips ; from San Jose to San Diego and from Seattle to San Francisco. That’s exploring America vertically! But I wanted to crank up things by a notch and take on a new personal challenge – can I travel coast-to-coast, from sea to shining sea, across the lower contiguous United States? The trip would entail four days of travel – with a day’s break built into a night’s rest in the heart of Chicago, Illinois. My god what an elongated, lengthy trip! I crossed twelve states – California, Nevada, Utah, Colorado, Nebraska, Iowa, Illinois, Indiana, Ohio, Kentucky, West Virginia, and Virginia – and many geographic provinces and climatic zones of America! And across the states, all the different regions – California’s central valley, the Sierra Nevadas, the Great Basin and Range, the red-brown Colorado Plateau, the mighty Western Rockies, the mid-western prairies, the central Great Lakes, Appalachia, and the mid-Atlantic.

    The trip involved taking two trains – two days aboard the California Zephyr, starting from Emeryville, CA and ending at Union Station, Chicago, and one day aboard the Cardinal, snaking its concave up bow-like meander from Chicago to Washington D.C. I could’ve have straight shotted and completed the trip in three days, but two days on a coach seat felt intense ; I needed one day of recuperation in Chicago’s windy city to catch up on sleep, relax, and recuperate.

    Alright all aboard and let’s begin!

    Day One – Crossing the Sierra Nevadas and Nevada – from Emervyille, CA to Salt Lake City, Utah

    Day one’s trip involved traveling from Emervyille, CA to Salt Lake City, Utah, where the train stopped overnight for a break. I left around 9:00 a.m. or 10:00 a.m. and covered ground through the Central Valley, the Sierra Nevadas, and the Great Basin and Range. Unfortunately, I went during late autumn – a time period when this part of the world gets inundated by rain and snow storms – so I didn’t see to much. Nonetheless, there were times the sun’s rays pierced through the thick cloud cover ; I caught glimpses of the state’s eastern escarpment and of Donner Lake : a historical area where the Donner Party survived harsh, brutal winters by resorting to cannibalism as a last resort. We ascended in elevation by about 4,500 feet ( where Renova, Nevada sits ).

    Day Two – Into Thin Air : Salt Lake City, Utah to Denver, Colorado

    This part of the trip was the most scenic and photographic. We embarked from Salt Lake City, crossing through

    The California Zephyr – a long-distance, long-haul train with a three day journey.

    Day Three – race through the mid-west, from Denver, Colorado to Chicago, Illinois

    #TODO

    Day Five- a windy City Break

    #TODO

    Views of the Windy City’s urban core, taken from the top of Willis Tower. I lucked out on a small opening in this incredibly fog-packed fall morning.
    Chicago’s Union Station – known for it’s historical significance during the city’s heyday as a train junction and as an American cinematography backdrop.

    Day Five- across Appalachia and the Blue Ridge Mountains, homebound to the Capital

    Ok onto day five – we’re almost nearing the journey’s coda and conclusion. To my luck, the Cardinal felt relaxed – it departed late night from the Windy City and rapidly cut through the flat lands of Indiana’s many farms. The excitement of travel picked pace up again the following morning , where I woke up to the sights of West Virginia’s Appalachian plateau – the remnants of a mountain chain which once used to world’s tallest, but eroded down to its namesake by the powers of erosional forces, sedimentation, and deposition over millions of years. My Amtrak train slowly snaked along the plateau’s many dissecting river and valleys; I took notice of the scenes and snapped extensive photography of memorable sights such as the New River Gorge bridge.

    The cardinal – with terminuses connecting Chicago, Illinois and New York City, New York – traverses with a concave up pattern. I hopped off early in Washington D.C.
    New River Gorge Bridge – the train snakes along the New River’s valley of West Virginia’s recently-created national park
    A coal-carrying freight train along Virginias’ Blue Ridge Mountains during sunset. Even in modernity, freight continues to transit raw resources to industrial centers.

    And comes the coda and conclusion of journeying across America … by Train :-O !!!

    I absolutely enjoyed the third Amtrak train experience – far more than the first and the second. Ok well the first holds nostalgia- for being the first – but the third dwarfs it experientially. I am also always telling people about the trans-continental Amtrak train trip.

  • TRAVEL – The Top 7 Tips and Tricks for the sleeves and the bags of the all-American Amtrak Traveler

    This advice extends very well to train systems in other parts of the world too! But I’m going to down-scope the focus on just America!

    That’s me standing on the train platform from Winter Park, Colorado – about 9,000+ feet into Thin Air

    Ok Let’s Hit the Ground Running with … a couple of useful things to know.

    1. Do bring a solid camera ( DSLR ) ( or other photo-taking instruments )
      • Open up your passenger-side window blinds or hit up the 360-degree Observation deck. You’ll take in amazing landscape photography.
    2. Bring a blanket – or other light supplies – for sleeping overnight on coach ( unless you plan to use the roomette or first-class room service ).
    3. Amtrak meals are worth their cost – yes you can bring your own food and beverages, BUT, their dining car service offers amazing food at a large volume and bargain prices, making for memorable experiences.
      • Dinner meals of around $40.00 USD per person may seem expensive, but their lunch and breakfast options are surprisingly cost-affordable and hover closer to $20.00 per person1.
    4. Have conversations with the strangers! Bring a deck of cards of board games.
      • It’s easy to break the ice and introduce yourself to travelers – especially in the all-carriage accessible observation deck. More ever, you will learn tremendously about the world by talking to others aboard.
    5. Bring mobile packs and chargers.
      • Most long-distance Amtrak passenger seats have outlets, but they may be taken up – bring portable backup battery packs.
    6. Bring a book! Or two! Or three!
      • Amtrak trips are lengthy, distraction-free environments with the accompaniments of beautiful landscapes and rhythmic locomotive noise. I don’t imagine you’ll gaze out of the window 24/7, so kick back and devour the book you’ve been meaning to. My best readings – like Cal Newport’s Deep Work – took place on Amtrak rides.
    7. When booking seats, book for the second level – not the first.
      • Second level seating beats first level seating for the best landscape photography and views. If I recall correctly, there’s no price difference between the lower levels versus the upper levels of carriages.

    So what’s my takeaway here?

    Most importantly, focus on relaxing and enjoy the journey.
    There’s no perfect way for anyone to travel – it all boils down ( and grossly simplifies ) to the style that suits you apropos and best.
    Also I invite you all to share your own tips or experiences in the comments! I wanna hear what y’all have to share!

    1. At the time of this writing, 02/21/2025, and to best personal memory, these are the prices I’ve posted. ↩︎

  • LEETCODE – Tackling a Leetcode Medium Problem – “1911. Maximum Alternating Subsequence Sum”

    Background to the Problem

    Hi all

    Today, I’ll be sharing how to tackle a leetcode medium-level difficulty problem. Our problem under question is Leetcode 1911 : Maximum Alternating Subsequence Sum. It’s a classic dynamic-programming problem, where in an efficient solution leveraging linear memory is needed in order to obtain polynomial time performance.

    The problem took me fifeteen minutes to solution and five minutes to debug. When I solve problems, I like to follow a templated structure. In this case, I first typed a line titled Approach & Categories; here, I categorized the problem in a Leetcode tag’s-esque style – Arrays, Recursion, and Dynamic Programming. This section framed and organized my mental thought process.

    Next I went over complexity analysis. The first step involved defining my “alphabet soup” variables : N = length(input). I then solution-ed time complexity ( linear O(N) ) and space complexity : explicit O(N) array allocation and implicit O(1) constant single function call stack frame allocation .

    I then followed up with a few notes on intuition and scenarios I wanted to cover. I wrote how the problem’s toughest aspect involved the handling of positive cases ( e.g. 4 – 2 + 5 – 3 ) or negative cases ( -4 + 2 – 5 + 3 ), depending on whether we did or did not select an element to start an alternating subsequence sum. The thinking of using two sums – one for even indices and another for odd indices – let to an allocation of the N*2 DP array.

    The Solution’s Code

    '''
    1911. Maximum Alternating Subsequence Sum
    URL := https://leetcode.com/problems/maximum-alternating-subsequence-sum/
    
    Approach & Categories : Arrays, Recursion, Dynamic Programming
    
    Complexity
    N = len(input)
    Time = O(N)
    Space = O(N) ( Exp ) O(1) ( Imp ) 
    
    Intuition :
    - Have to handle for both positive cases and negative cases
    - Think : if we select an element as starter, it's x + bestNegCase
    - Else if no select, it's bestRunningPositiveCase
    '''
    class Solution:
        def maxAlternatingSum(self, nums: List[int]) -> int:
            mas = 0
            n = len(nums)
            dp = [[0 for i in range(n)] for j in range(2)]
            # base case = the first element
            posIdx = 0
            negIdx = 1
            dp[posIdx][-1] = nums[-1]
            dp[negIdx][-1] = -1 * nums[-1]
            bestPosSum = dp[posIdx][-1]
            bestNegSum = dp[negIdx][-1]
            mas = max(bestPosSum,bestNegSum)
            for idx in range(len(nums) - 2, -1, -1):
                startVal = nums[idx]
                # The bug was here! CAUGHT IT !!!!
    curPosSum = max(startVal, startVal + bestNegSum)
    curNegSum = max(-1*startVal, -1 * startVal + bestPosSum)
                bestPosSum = max(bestPosSum,curPosSum)
                bestNegSum = max(bestNegSum,curNegSum)
                dp[posIdx][idx] = bestPosSum
                dp[negIdx][idx] = bestNegSum
                # always start with positive element
                mas = max(mas,bestPosSum)
            return mas

    Catching the Bug

    Debugging this was somewhat tricky. I had to modify two lines so as to account for a case where the elements under selection themselves led to the best selection, versus the element + best running sum. Can you spot the subtle difference here?

    Erroneous code :
    curPosSum = startVal + bestNegSum
    curNegSum = (-1 * startVal) + bestPosSum
    Correct code :
    curPosSum = max(startVal, startVal + bestNegSum)
    curNegSum = max(-1*startVal, -1 * startVal + bestPosSum)

    Performance Statistics

    Now let’s see performance statistics too !

    For a Python3-written solution, we’re doing good with time complexity and space complexity. Nearly beating 50% of users with space complexity here!
  • TRAVEL – The second Amtrak Train Journey : From rainy Seattle, WA to sunny San Francisco, CA

    So why did I travel across the three states of the West Coast – Washington, Oregon, and California… by a train!

    For about a week during March 2023, I stayed over at my uncle and aunt’s home in Seattle, Washington, spending quality time with my extended family and devouring books in their makeshift library. Like the trip between San Jose and San Diego, I could have taken a quick two hour direct flight between the two major Pacific metropolises. But I thought to myself that not only would a second train journey be magical – it would also complete a near cross-country journey across the vertical length of the continent United States. More ever, Amtrak travel entails a myriad of benefits for travelers – extra leg room, freshly-prepared meals, an more eco-friendly travel mode, observation deck views, memorable conversations with strangers, and seeing the country through a unique lenses. Unlike the first train ride though, this one would be the first overnight train where I would sleep in the coach seats ; day one would be spent in the states of Washington and Oregon, whereas day two focused on California. Alright, let’s explore both days !

    An almost one-day journey between King Street Station, Seattle and Emeryville, CA – snaking its way along the Pacific Northwest’s Evergreen Cascadian ranges

    Day One : Race Through the Pacific Northwest States of Washington and Oregon

    I initially left King Street Station sometime around 10:00 a.m., heading South from Seattle, WA to Portland, Oregon. Like most days during Spring, the weather took on its typical form of overcast cloudy skies with mild interspersed precipitation, save for occasional breaks of sunny skies and rays piercing through the cloud layer. The section in Washington wasn’t as “exciting”, but still held a couple of interesting sights to observe. Nonetheless, it made for solid focused reading time – I worked my way through a few sections of Chip Hyugen’s Designing Machine Learning Systems book !

    Upper Washington’s verdant vegetation – notice the extensive moss and lichens characteristic of this biome.
    The train tracks along the Columbia river – which bifurcates both states
    The cascades mountain range in the background of the Columbia Valley’s farms. I’m looking east towards them from the rain-catching side.

    Now onto entering Oregon – the fun, memorable section. I first stopped in the city of Portland for half an hour at union Station ; I figured this would be an opportune moment to decompress, stretch, and inject some physical activity – especially given the day’s length of the train journey. I also purchased snacks and a few postcards and walked myself around in Union Station, taking in the smells, sights, and sounds of the historic building.

    Entering Portland, Oregon – three-and-a-half hours South of Seattle, Washington.
    Promenading around Union Station for half-an hour – the building’s been around for almost 100+ years !

    The train then set forth southeast to Dunsmuir, California from Portland’s Union Station. But in order to do so, it had to cross the cascades – which not only entailed slow train travel along an ascent through mountainous, hilly terrain, but also entailed a loss of cellular reception for about three hours. While it sounds scary, it really wasn’t, given the glacial and safe rate of ascent. But back on topic, the best portion of this trip involved the dinner time winter wonderland experience in the dining car; I saw the stratus clouds of rain and drizzle slowly morph into a snow storm and the fog-covered landscapes change into a frozen arctic tundra. It was a must see to glimpse in one’s lifetime sight!

    Entering into the cascades mountains and crossing from the Western portion to the interior Columbia Plateau. No cellular reception here for three hours!
    The 360-degree observation car deck views – both sides offer seats and glimpses into the terrain.

    Waking up for Day 2 – in the Farms of California’s Central Valley

    On the second day of the Amtrak journey, I woke up to the sights of drier, desiccated landscapes : a quilted patchwork of small town America, sprint-time blooming orchards, fecund farms, and man-made canal irrigation systems. California’s Central Valley – a stark contrast to yesterday’s trip – teleported me from a rainy, verdant world to a drier realm. Nonetheless, I took in the beauty to admire, and for someone domiciled in the state’s west coast – a more-urbanized and media dominant portion – I, a wandering sojourner, got a good reminder of what the rest of California represents.

    This trip segment was short-lived – I spent only a few hours in the morning taking in the splenetic, sunlight views from the observation deck and the dining cars. I woke up to the trains’ quotidian, hum-and-drum sound : constantly recurring on a rhythm beat. The breakfast meal involved a delicious 30-minute meal of Amtrak’s baked bread, healthy fruit, a grilled cheese sand-which, and coffee – a jam-packed All-American continent breakfast. I took the time to get my senses back to normalcy from a night of serious sleep deprivation ( it’s not easy to sleep on Amtrak coach) and then started collecting photos from the observation deck. Let me share them!

    Landscapes of the Central Valley : notice the sudden transition from the Pacific Northwest’s verdancy to California’s grasslands of dryness and desiccation.
    Observation Deck Orchard views of trees : walnuts, olives, and apples. Central California is renowned for extensive fruit and nut production.
    Around the the Sacramento-San Joaquin Delta – extensive marshlands and wetlands envelope the confluence region of two major rivers.

    And in conclusion !!!

    I absolutely enjoyed the second Amtrak train experience – even more than the first experience, in its own unique ways. This journey took place a year following the first leg stretch between San Jose and San Diego, and was definitely more involved with planning and preparation. It felt more challenging, but yet, exhilarating to go on a 24-hour train ride. I’m also always telling other people about my solo travel story on the Coast Starlight.

  • TRAVEL – The first Amtrak Train Journey : From San Jose, CA to San Diego, CA

    So why did I travel across California … by a train!

    I planned a train trip from San Jose, California to San Diego, CA, where I would stay with my aunt’s family – my aunt, her husband, her son, and my grandmother. I could have embarked on a quick one to two hour direct flight between San Jose and San Diego, but I thought the train journey made for a better, more “magical” experience. That, and I am an absolute bona-fide nerd for major transit systems – with train systems in particular holding a childhood fascination. Train travel holds a magical element; just think – the sensory feelings, the breath-taking sights, the vistas, the terrains of planet Earth, and the people you meet – all add up to an amazing experience.

    Planning the journey with Google Maps

    Planning the journey took a couple of key ingredients : creative thinking, day-dreaming … and a few minutes of playing with the mini-man on Google Maps 🙂 . Now let’s go through google maps and see the route plan.

    Before embarking, I thought I would be able to travel directly from San Jose Diridon Station to San Diego’s Sante Fe station, but I was amiss. It turns out that there’s no direct train route servicing between the Bay Area and San Diego. But not all was lost … for luckily, the state of California has more than just one Amtrak line. Let’s look at a map of lines !

    California’s extensive Amtrak routes. I believe we have at least five plus Amtrak routes, with some routes focused intrastate and others routes interstate.

    Ok back to topic. I split travel up into two days across two segments. The first segment arranged from San Jose Diridon Station to Los Angeles’s Union Station – via the Coast Starlight. And the the second arranged from Los Angeles’s Union Station to San Diego’s Santa Fe Station – via the Pacific Surfliner.

    Segment one – through central Cali : the mountains, the farms, the valleys, and the shining Pacific coast!!

    Travel by the first segment entailed a minimum of ten hours and forty-five minutes of travel; I started early in the morning around 9:00 a.m. and reached my destination by 8:00 p.m. or so . I didn’t have a DSLR or fancy camera with me, but I did have my mobile phone, a battery park, and a plug-in charger – all the tools I needed for travel photography.

    Day one’s segment – the Coast starlight – from San Jose Dirdon Station to Los Angeles Union Station
    Selfie with carriages in the background ! Each traveler carriage features two levels of seating, save for the observation deck, the dining car, or roommete/first-class room compartments.
    A breath-taking sunset somewhere along the beautiful Malibu Coast. Now who wouldn’t admire the crashing of the roaring waves of the Pacific battering the sun-bathed sandstone cliffsides.
    Outside Union Station, Los Angeles – the intermediate stop on the journey. I spent the night in a hotel nearby this station to recuperate, relax, and get some much needed sleep.
    Union Station, Los Angeles – seen in quite a number of famous American films. The ceiling’s geometric artwork captured my attention.

    The second segment – let’s race through SoCal!

    Luckily, the second segment went more smooth-sailing ; it took only three hours and thirty minutes of transit time. I started early this day, but I reached my destination by noon. Surprisingly, the journey between the two stations actually takes around time – in fact, I would argue less time – than driving down over the interstate. The views from Union Station to San Clemente aren’t that exciting ( we’re deep in the urban core and the suburbs of Los Angeles ), but they morph into amazing vistas during the last mile stretches between San Clemente and Santa Fe.

    Day two’s segment – the Pacific Surfliner – from Los Angeles Union Station to San Diego.
    Taken from the Pacific Surfliner’s 360-degree observation deck near sunny Oceanside, CA. The train closely skirts and snakes its way along California’s beautiful beaches.

    And in conclusion !!!

    I absolutely enjoyed my first Amtrak train experience. The journey – taking place two months after coming into California from the East Coast for a new job – solidified itself as a core memory. I am always advertising and talking on and on about the train trip with my friends – at lunch meetups, at restaurant outings, and even hiking trips. I think I even convinced a couple of guys to go out in a group ( and even bring board games to play on the observation car deck ). Positive formative memories in life are to be made, and Amtrak asserts itself as a way to do so !

  • A brief overview of my ( extensive? ) travels

    Hi all – I’ll be giving a quick run down of the countries that I’ve lived in, seen, or even set foot on during my 28 years of existence on our Blue Planet ( a.k.a. Earth ) ! Let’s get this list and map started.

    Countries_Visited
    I haven’t toured much of the world yet, but I can’t wait to get this further filled out. More years to filling in the gaps.

    A list of 6 Countries Visited

    1. United States of America
    2. Canada
    3. Japan
    4. India
    5. Hong Kong
    6. South Korea ( ROK )

    Visualization Tools Used

    1. https://countries-visited.com/states-visited.html

  • LEETCODE – Master Leetcode-Style Big Tech Interviewing – with a Structured, Templated Approach!!!

    ‘Practice does not make perfect. Only perfect practice makes perfect’ – Vince Lombardi, legendary American football coach

    We’ve all been there and we’ve all experienced it – studying for interviewing and interviewing for tech companies is hard. Whether you’re a college student applying for your first internship, a recent graduate entering the workforce for your first junior role, or even a seasoned senior engineer targeting the higher levels of the industry. For many of us, algorithmic interviewing is exorbitantly difficult. But nonetheless, technical interviewing remains a trainable and learnable skill, and one that anyone can deliberately practice and upskill !!!

    My leetcode profile ( for evidence that I know what I’m talking about )

    This is far more problems than you need to solve to crack into FAANG/MAANG or other companies; I personally do this for the fun of problem solving.

    A Templated Structure to Algorithmic Interviewing

    Organizing one’s thought process is surprisingly hard, and observations of both myself and others has shown me that effective, clear communication and storytelling matters tremendously. Before I start coding or problem-solving, I tell my interviewers that I like to follow a templated structure to help organizing and crystalize my thought process. Each section usually takes me an allocated amount of time to finish and varies interview-but-interview – whether 30-minutes or 60-minutes in length – but they follow a pattern. Let me show!

    Clarifying Questions (5 minutes ):
    Category and Approach: ( 5 minutes )
    Complexity Analysis ( 5 minutes ):
    – Time
    – Explicit Space =
    – Implicit Space ( function call stack allocation ) =

    Unit Test Scenarios : ( 5 minutes )
    Coding : (10 minutes – 30 minutes )

    Why Follow Templated Structures?

    1. Ordering : Templates follow orders, and people psychologically love order and structure.
    2. Persistency : Interviewers can copy-paste your writings and reference them later when determining if you pass a stage or an offer letter. Your writings will help interviewers refresh their memories days or even weeks following your interview

    Your interviewer asks you to code … but wait, don’t just dive into coding!

    Please ask questions! The more the better!

    Diving into code is tempting – especially with the time crunch that interviewing is. Most interviewers want to see their interviewees type code, with the ideal being working code that passes all unit test cases ( think of a leetcode medium done in <= 30 minutes ). But solid seasoned developers know that before coding, diving into the question under asks matters more. Let’s touch on common clarifying questions to ask include ( and why they’re good to ask ) :

    1. Does the input fit into RAM/memory? Can I expect reasonably sized inputs? Do we need to handle for a streaming edge case?
      • TC demonstrates forwards-thinking of edge case scenarios where algorithms need to be made more time-efficient or space-efficient in the event of running into scalability concerns ( e.g. inputs fitting across multiple disks or near RT streaming systems processing +1 million records/second ).
    2. Can I expect well-formed inputs? Do I need to validate the inputs?
      • TC demonstrates thinking of whether to write code to handle for malformed inputs.
      • TC demonstrates real-world thinking of commonly-encountered problems with input validation, transformations, or sanitization.
    3. Do I need to handle the null case or empty input case ( e.g. input list = [] or input list = None )?
      • Similar to #2, TC shows forward-thinking of edge case scenarios which can manifest in real-world problems.
    4. Are the inputs strictly integral? If so, are they all positive or non-negative integers? If they are floats, do we have to account for precision? If inputs are floats, do they correspond to monetary situations – e.g. USD and cent-denominated billing ( e.g. $100.99 or $200.62 )?
      • TC shows thinking about data types, which have been known to cause major technical disasters, widespread systematic failures, or major losses of revenue for companies ( see Y2K incident ).
      • TC shows thinking about how to modify future approach and scoping down code complexity
    5. If the input is a tree, can I expect perfect binary trees where each node has 0 or 2 children? Or can we have trees having nodes with a single child?
      • TC is really thinking about the many forms data structures can take on and how to handle edge case scenarios.
    6. If the input is a graph, is it directed or undirected? Does it contain cycles or parallel edges? If so, how should a cycle or a parallel edge be handled? Can I have a single node graph with no edge? Do I operate with one connected component or multiple connected components?
      • Similar to part #5, TC is really thinking about the many forms data structures can take on and how to handle edge case scenarios.

    But like, what do I have permission to ask my interviewers?

    • Hydration : You have permission to hydrate and drink water.
      Your voice can get raspy and dry in a 5-hour onsite and they can dehydrate you. Let’s get your electrolytes and hydration back to normal, functioning levels 🙂 .
    • Use pen-and-paper : You have permission to ask to use pen-and-paper – or a shared online whiteboard/collaborative editing tool – to visualize a problem and diagram for 2-3 minutes.
      I’ve observed in myself and others that we problem-solve best with visuals. Unlike digital-only processing, there’s something subconscious that goes on in physical sensory processing with one’s hands and a pen that enables better performance. And given how many different brains and cognitive styles exist in the world, interviewers will bias towards letting you use the mediums that enable your best thinking to come out.
    • To get a pause : You have permission to ask to take 2-3 minutes to think about your approach to “drive the conversation”.
      A good interviewer understands that their problems are hard. Keeping a conversation going in (near) real-time matters, but if you need to think for 2-3 minutes due to processing loads of information, go for it!!
    • To drive the conversation : You have permission to ask your interviewers if they want to stop you to ask clarifying questions.
      If you get concerned about driving the conversation by yourself, stop and literally instruct me in the beginning “If you want to stop me and ask clarifying questions, please go ahead and do so.”. I’ll know to tell you when to stop so that I can steer the conversation towards areas of interest or other directions.
    • Deviate from templated structures : You have permission to deviate from any author’s templated structure, process “out-of-order”, and focus on the sections that highlight YOUR strengths.
      Some of us are better at reasoning about time-complexity ; others on thinking of unit test case scenarios ; and others on coding. I personally want you to focus on the area that best enable your cognitive style.

    YOUR GREEN SIGNALS – WHAT DEMONSTRATES YOUR SKILLS

    What are some of the “green” signals that interviewers are really looking for? What makes me hire-able to the hiring table? Something that screams to my interviewers “Oh woah, this candidate is amazing! They’re super experienced and they know exactly what they are doing! I wanna hire them on spot!“. Let’s look !

    1. TC talks about implicit space/function call stack space – most candidates will talk about explicit space allocation ( e.g. I need to allocate a O(MN) grid for my problem ). But implicit space shows that a candidate thinks about how deep a function call stack can go. It’s super relevant in recursive settings, such as processing a tree data structure, where a candidate should argue that implicit stack space is O(H), H := height of the tree.
    2. TC distinguishes coding style : interview setting versus production setting – I usually expect that more senior candidate naturally write code with more readable variable names (e.g. cases_recorded versus cr ). Nonetheless, a solid engineer can argue that for the sake of brevity and time, they’ll use short-hand names, even though in a production setting, they’d make modifications
    3. TC emphasizes functional decomposition – the best solutions involve small methods built around SRP ( Single Responsibility Pattern ). In the real-world, developers bias towards small functions that are quick to review and write unit tests for.
    4. TC introduces logging/error handling – real world development requires writing debug output to centralized logging ( e.g. Splunk / New Relic ) returning errors ( e.g. HTTP Status Code, HTTP Response ) from caller to callee. Shows evidence of systems thinking.
    5. TC writes unit tests/emphasizes Test-Driven Development – software engineers spend half their time writing good code; the other half writing good tests. Mentions of testing show that TC can handle job duties.
    6. TC mentions usage of existing library method – in the real-world, let’s not repeat ourselves. We don’t have to write code to compute factorial if a single one-liner math.factorial(n) already exists as a Python method. It shows the DRY ( Do not Repeat Yourself ) pattern,

    Tell me the signs that I’m getting better!

    There’s a couple of different signs that tell me if someone is getter better at algorithmic thinking and solving Leetcode-style problems. Lemme review some of them!

    1. Spending less time – you spend less time finding solutions. You per averages over time decrease on leetcode mediums : 1 hour – 30 minutes – 15 minutes.
    2. Beating the user base – beating others in memory-efficiency and time-efficiency. Sometimes, you even beat 100% of users ( in a given language/runtime ).
    3. Higher success rate – you tend to write solutions that work, versus don’t work.
    4. Immediate pattern recognition – you can see the patterns quickly. You know when to map a problem to a pattern seen earlier such as Two pointers, Arrays, or Dynamic Programming.
    5. You’re solving harder problems – problems that used to be hard no longer give your brain a challenge. You take harder problems as you keep solving problems.
    6. You write the unit tests – you write up test cases and run scenarios ahead-of-schedule, instead of executing the RUN or the TEST buttons.
    7. You can categorize – leetcode problems are categorized by a set of tags ( e.g. arrays, Linked Lists, Graphs ). You can immediately identify a set of tags to classify problems.
    8. Bottom-up dynamic programming is first – when given a DP problem, you immediately think of a BUDP ( Bottom-up Dynamic Programming) approach first. You skip the naive recursive steps or the Top-Down Memoization-based approches.
    9. You write the solutions – you can write your solution and post them on the website’s platform.
    10. Get unstuck less often – you’ll still get stuck on some problems, but you’ll be able to confidently tell yourself that you’ll soon get unstuck. The solution will come to you in a few days or a few weeks ( after subconscious processing ) .
    11. Your solution is better than the official solution – hey, sometimes, you can be scaringly bright and conjure up a vastly different solution that’s significantly better than what’s posted. There are so many different solution paths to a problem !!

    In Conclusion

    Way to go for making it through this section!!!!
    I know it’s a lot to digest and to process, but I think all of this is going to be super useful and helpful. I’m personally wishing you best of luck in your future technical interviews 🙂 !

  • A brief overview of my ( extensive? ) travels

    Hi all – I’ll be giving a quick run down of the American states that I’ve seen ( or set foot on ) during my 28 years of existing on planet Earth! So let’s get started with the list. I think a visual map communicates more than bullets – let’s dive in!

    I’ve visited most of contiguous America, but not remote states such as Alaska or Hawaii yet. One day!

    A list of 31 states visited

    1. Washington
    2. Oregon
    3. California
    4. Nevada
    5. Utah
    6. Colorado
    7. Nebraska
    8. Oklahoma
    9. Texas
    10. Iowa
    11. Missouri
    12. Arkansas
    13. Louisiana
    14. Illinois
    15. Indiana
    16. Kentucky
    17. Tennessee
    18. Mississippi
    19. Alabama
    20. Georgia
    21. Florida
    22. South Carolina
    23. North Carolina
    24. West Virginia
    25. Virginia
    26. Maryland
    27. Delaware
    28. Pennsylvania
    29. New Jersey
    30. New York
    31. Connecticut

    American Territories and Districts Visited

    1. Washington D.C.

    Visualization Tools Used

    1. 1. https://countries-visited.com/states-visited.html

  • READING – My Top Five Favorite Books

    Hi all,

    I’ll provide a quick run down of my top 10 favorite books with short descriptions, along with the rest of the list of favorite books. Let’s get started !!!!

    Note : I haven't worked through all these books! Don't think I finished reading them all. 

    The Top 4 Books!

    The Elements of Style – William Strunk Jr. And E.B. White

    My high school English teacher ( Ms. Bello ) introduced me to this book either my sophomore year or junior year of high school and I still consult it to this day. Ms. Judith Bello – renowned for her teaching prowess, her absolute empathy to students, her joyful and young attitude to life even in her old age, and her dedication to editing and spending time offering feedback on student’s essays – strongly influenced the course of direction of my life and still exists in my memory as a positive influence. She frequently referenced Strunk and White’s book to emphasize solid writing practices for students –  biasing from the passive voice ( I was told by him ) to the active voice ( he told me ), replacing weak verbs ( led ) with strong verbs ( spear-headed ), and minimizing the usage of the over-hackneyed verb to be . 

    The Elements of Style
    Drilled and remembered into core memories.

    Deep Work: Rules for Focused Success in a Distracted World – Cal Newport

    Written by esteemed computer science professor Cal Newport, Deep Work goes over a review of effective strategies towards digitally detoxing and reclaiming one’s sense of focus. I vividly recall reading his book my junior year of college on an three-and-a-half hour Amtrak train journey from Seattle, Washington to Portland, Oregon. His book influenced my thinking in needing to remove digital distractions – reducing clutter, checking e-mails and social media less often, and carving out half-hour to three hour blocks of time to engage in the toughest of tasks. Putting his strategies into tasks – reading complex research papers, solving complex theoretical problems, or gathering information – empowered me through the toughest of collegiate assignments. His blog ( https://calnewport.com/blog/ ) – Study Hacks – helped me learn how to conduct effective research, gather spreadsheet-organized evidence, and present well-sourced information in a thoughtful, organized manner.

    A fantastic, train-journey read book powering me through the toughest of assignments.

    Dynamic Programming for Coding Interviews : A Bottom-Up Approach to Problem Solving – Meenakshi & Kamal Rawat

    Written by two technically amazing authors – Meenakshi and Kamal Rawat – dynamic programming for coding interviews holds up to its titular name as a fantastic introduction to tackling one of the hardest categorization of algorithmic problems. The authors do a superb job teaching readers about function call stacks and implicit space allocation in the first chapter, coupled with a review of a templated, structured approach to DP problems – first starting with a naive recursive solution, followed by a top-down memo-ized solution, and concluding with a bottom-up solution. Meenakshi and Kamal do a fantastic job cutting right to the chase ; they hone in on a specific subset of dynamic problems of focus – best alternating subsequence of min number of characters to make two strings equal – and offer clear visuals undergirding an well-organized thought process. I immediately recommend this book to every person I’ve met who shares with me that they struggle to tackle dynamic programming: 10/10 stars

    The best book for going from zero to hero on dynamic programming.

    Guns, Germs, and Steel: The Fates of Human Societies – Jared Diamond

    Written by Pulitzer prize winner Jared Diamond, Guns, Germs, and Steel dives deep into the causations of the modern world, and why it came about it’s shape. With his strong emphasis on a surprising combination of factors – geographic advantages, timing, incentives to technological innovation in warfare-plagued Western regions, and the spread of ideas across Eurasia – Diamond provides well-supported insights into how Western Europe became the world’s dominating power, starting in the 1500s. Withstanding significant critiques for his Eurocentric approach and bias towards geographical determinism, Diamond at least does the job of attempting to ask one of the most puzzling questions about world history. He also does a fantastic job hooking his readers in with the first chapters set place in the remote country of Papa New Guinea; here, a local tribesman asks the author the fundamental question under discussion – why did Western Europe “rule the worldand “develop” the most recent “technological innovations”? why didn’t another society do so?

    When you really have questions about history and you like to ask “what if” type of questions.

    My Other Favorite Tech Books!

    1. The Lean Startup: How Today’s Entrepreneurs Use Continuous Innovation to Create Radically Successful Businesses
    2. Cracking the PM Interview
    3. Cracking the Tech Career
    4. Programming Interviews Exposed
    5. Intro to Algorithms, 3rd Edition

    All the Other Books!

    1. What Color is Your Parachute [ 2018 ] – Richard N. Bolles
    2. The Life-Changing Magic of Tidying Up: The Japanese Art of Decluttering and Organizing – Marie Kondo
    3. On Civil Disobedience by Henry David Thoreau
    4. The Kite Runner by Khaled Hosseini
    5. Verbal Judo: The Gentle Art of Persuasion, Updated Edition Updated ed. Edition
    6. The Defining Decade: Why Your Twenties Matter–And How to Make the Most of Them Now
    7. Drive: The Surprising Truth About What Motivates Us
    8. Getting Things Done: The Art of Stress-Free Productivity