Post-interview DS&A Coding Insights in 2025

The questions below will be in a reverse-chronological order as they appeared in the interviews.

Simulated Calculator in String Processing

Calculator V1 - LC 224. Basic Calculator (Hard)

Essentially, merely +- arithmetic operations and parenthesis (nested possible) need to be supported.

Concise & efficient Solution after refactoring

Upon second thought, it appears that stack operations are need only when destructing parenthesis and processing the +- operators (see also other shared solutions on LeetCode).

Read more

Post-interview FE Coding Insights in 2025

Nuro 45-min FE Interview - late-June

Problem description:

1
2
3
Self dismissing modal
1. When button is clicked, modal should cover the page
2. After 5 seconds, the modal closes on it's own

Revised implementation w/o error risk when using JSX element VS functional call:

Read more

Manjaro UI Improvement

These usages are helpful to build a solution of NAS Status Monitor Visualization.

Fix pacman-mirrors: ModuleNotFoundError

Look for the missing modules failed to be imported:

1
sudo pacman -S python3 python-urllib3 python-charset-normalizer python-idna

Fix blocking pacman upgrade failure

Option 1:
1
2
sudo pacman-mirrors -g -f5
pamac upgrade --force-refresh
Option 2:
1
sudo pacman-mirrors --fasttrack && sudo pacman -Syyu

Also check for

1
yay -Suy

It’s sometimes possibly also needs to remove conflicting packages to proceed, rather than trying to install by force using the pacman options -d/-dd/-nodeps.

Allow installing dependencies from AUR

1
sudo pacman -S yay

UI tools

1
2
3
yay -S gotop
sudo pacman -S bspwm sxhkd polybar picom dunst dmenu nitrogen
sudo pacman -S mpd ncmpcpp

UI modules

1
2
sudo pacman -S rofi calc xorg xorg-xinit xorg-xbacklight alsa-utils
yay -S pywal networkmanager-dmenu

Font dependencies

1
2
sudo pacman -S ttf-font-awesome [ttf-dejavu]
yay -S ttf-material-design-iconic-font ttf-unifont ttf-cascadia-code ttf-nerd-fonts-symbols ttf-material-icons

Check if TTF fonts are present in the OS:

1
2
fc-cache -f -v
fc-list | grep ...

Clock

1
systemctl start mpd.service

Press = after starting ncmpcpp in CLI.

Python Interview Refinement in Mid-2023

LRU Cache

1
2
3
4
5
6
class Node:
def __init__(self, key, value):
self.prev = None
self.next = None
self.key = key
self.val = value
Read more

Arch Linux Environmental Setup FAQ

Dependencies

  • Issue of dependency conflict or failure to find the dependency that should be there:

    sudo pacman -Syu –debug
    It triggers a prompt
    This also performs wide-range package upgrades.

  • Issue of CMake / makepkg -si:

    1
    2
    3
    4
    5
    6
    7
    8
    ==> Starting build()...
    CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".
    CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
    CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
    CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
    -- Configuring incomplete, errors occurred!
    ==> ERROR: A failure occurred in build().
    Aborting...

    To resolve such building depedencies:

    sudo pacman -S base-devel

    1
    2
    3
    4
    5
    Packages (12)
    autoconf-2.71-4 automake-1.16.5-2 bison-3.8.2-5
    debugedit-5.0-5 flex-2.6.4-5 gc-8.2.2-1 guile-3.0.9-1
    m4-1.4.19-3 make-4.4.1-2 patch-2.7.6-9 pkgconf-1.8.1-1
    base-devel-1-2
  • Install pytorch with ROCm backend (read more)

    For CPUs with AVX2 instruction set support, that is, CPU microarchitectures beyond Haswell (Intel, 2013) or Excavator (AMD, 2015), install python-pytorch-opt-rocm to benefit from performance optimizations. Otherwise install python-pytorch-rocm.

    sudo pacman -S python-pytorch-opt-rocm

    This may generate an installation as large as:

    1
    2
    3
    4
    Total Download Size:    2654.00 MiB
    Total Installed Size: 29579.85 MiB

    :: Proceed with installation? [Y/n]

Appearance

Configure a ZFS volume for Time Machine on NAS

Preparation

A ZFS pool should surely pre-exist there to allow for the operations introduced later.

  • Key point: Why not split, or shrink existing volumes for a Time Machine volume?

    Not viable. A ZFS partition always tries to occupy as much space as possible, so does ZFS volumes under it, sharing the entire space of it. To reserving some space is exactly what the quota property is designed for.

    In addition, you can use the reservation property to guarantee that a specified amount of disk space is available to a file system. Both properties apply to the dataset on which they are set and all descendents of that dataset.

    More…

  • Creating a new ZFS filesystem

    zfs create -o compression=lz4 pool/filesystem

    where the purpose of an optional argument -o compression=lz4 is to turn on the compression for this dataset.

Read more

Non Built-in Data Structures And Algorithms in Python3

Unordered MultiSet

1
2
3
4
5
6
7
8
9
10
11
12
13
class MultiSet:
def __init__(self):
self.data = dict()

def add(self, val):
self.data[val] = 1 + (self.data[val] if val in self.data else 0)

def remove(self, val):
if not val in self.data:
return
self.data[val] -= 1
if self.data[val] == 0:
del self.data[val]

Fenwick Tree / Binary-indexed Tree

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class BIT:
def __init__(self, size):
self.size = size
self.data = [0] * size

def add(self, pos, val):
while pos < self.size:
self.data[pos] += val
pos += pos & (-pos)

def query(self, pos):
res = 0
while pos > 0:
res += self.data[pos]
pos &= pos - 1
return res
Read more

Universal Code Competition Template in Python3 (editing) [2022]

Number Theory

Quick power and modulo

To calculate $ n^m % mod $:

Division and modulo

DO NOT dividing an integer by another integer with respect to the modulus $mod$.
To calculate $ n/m%mod $ correctly ($ mod$ is a prime number thus $ φ(mod)=mod-1 $).
Use Eular function or modular multiplicative inversion.

Euler function $ φ(n) $

Quick greatest common divisor

1
2
3
4
5
6
7
8
9
10
11
12
13
def kgcd(a, b):
if a == 0:
return b
if b == 0:
return a
if (a & 1) == 0 and (b & 1) == 0:
return kgcd(a >> 1, b >> 1) << 1
elif (b & 1) == 0:
return kgcd(a, b >> 1)
elif (a & 1) == 0:
return kgcd(a >> 1, b)
else:
return kgcd(abs(a - b), min(a, b))
Read more