Other Coding & Algorithms Interview Questions
Practice the exact questions companies are asking right now.
Implement multiplication without using the multiplication operator
Implement int multiply(int a, int b) without using * or /. You may use +, −, bitwise operators, and shifts. Requirements: - Handle negatives, zero, an...
Prove reservoir sampling correctness
Design an algorithm to sample k items uniformly at random from a stream of unknown and potentially massive length N, using O(k) memory and one pass. (...
Write mini-batch gradient descent
Implement a generic mini-batch gradient descent routine: inputs are differentiable loss L(θ; x), initial θ0, batch size b, steps T, and learning-rate ...
Implement KNN from scratch
Without using ML libraries, implement k-Nearest Neighbors for classification. Requirements: (a) Support Euclidean and cosine distances; (b) Allow tie-...
Check if a numeric string is divisible by 8
Problem You are given a very large non-negative integer represented as a string s (it may be too large to fit in standard integer types). Write a func...
Find two numbers that sum to target
Problem You are given an integer array nums (length n) and an integer target. Return the indices (i, j) such that: - i != j - nums[i] + nums[j] == tar...