Given a string s
, find the length of the longest substring without repeating characters.
- Sliding Window
- Hashing
- Two Pointers
Input: "abcabcbb"
Output: 3
Explanation: The answer is "abc", with the length of 3.
Input: "bbbbb"
Output: 1
Explanation: The answer is "b", with the length of 1.
Input: "pwwkew"
Output: 3
Explanation: The answer is "wke", with the length of 3.
Python
def length_of_longest_substring(s: str) -> int:
# Implement your solution here
pass
JavaSctipt
fuction lengthOfLongestSbstring(s) {
// Implement your solution here
return;
Java
public class Solution1 {
public int lengthOfLongestSubstring(String s) {
// Implement your solution here
return 0;
}
}
Given an array of integers nums
and an integer target
, return the indices of the two numbers such that they add up to target
.
- Hash Map
- Brute Force Search
Input: nums = [2, 7, 11, 15], target = 9
Output: [0, 1]
Input: nums = [3, 2, 4], target = 6
Output: [1, 2]
Input: nums = [3, 3], target = 6
Output: [0, 1]
Python
def two_sum(nums: list[int], target: int) -> list[int]:
# Implement your solution here
pass
JavaScript
function twoSum(nums, target) {
// Implement your solution here
}
Java
public class Solution {
public int[] twoSum(int[] s, int target) {
// Implement your solution here
return [0,0,0];
}
}
Avatar: Jenna, a junior frontend developer, wants to build a real-time poll app she can demo to employers. She knows HTML, CSS, JS, and is learning React. She needs a simple, beautiful, and interactive app to showcase her skills.
Application: Build a real-time poll voting web app called QuickPoll.
Objective: Allow users to vote on a question and instantly see results.
Constraints:
- Only one question per poll.
- Options are defined upfront.
- Voting results update live (simulated).
- Should be built in 1 hour.
Stack Choices (Pick one):
- Vanilla HTML/CSS/JS with minimal state
- Vite + React with Hooks
- A poll question (e.g., "Which is better: cats or dogs?")
- Two to four options
- A way to submit a vote (once only per session)
- Show results as a percentage bar after voting
- Clean, responsive UI (mobile-friendly)
Question: What’s your favorite frontend framework?
Options: React, Vue, Angular, Svelte
After voting: Bars animate to show vote share
Avatar: Jenna, a junior frontend developer, wants to build a real-time poll app she can demo to employers. She knows HTML, CSS, JS, and is learning React. She needs a simple, beautiful, and interactive app to showcase her skills — but this time with a backend in Python using Flask.
Application Goal: Build a real-time poll voting web app called QuickPoll.
Allow users to vote on a poll question and instantly see results.
- One question per poll.
- Options are defined upfront.
- Voting results update live (simulated real-time).
- Should be built in 1 hour.
- Stack must use Python (Flask) for the backend and optionally React or plain JS for the frontend.
- ✅ A single poll question (e.g., “Which is better: cats or dogs?”)
- ✅ Two to four voting options
- ✅ Submit vote once per session (via browser cookie or IP check)
- ✅ Show results as percentage bars after voting
- ✅ Clean and mobile-friendly UI
- ✅ Simulate live updates using polling or WebSocket (simple version uses JavaScript polling)
Avatar: Jenna, a junior frontend developer, wants to build a real-time poll app she can demo to employers. She knows HTML, CSS, JS, and is learning React. She needs a simple, beautiful, and interactive app to showcase her skills — this time with a Java backend using Spring Boot.
Application Goal: Build a real-time poll voting web app called QuickPoll.
Allow users to vote on a poll question and instantly see results.
- One question per poll.
- Options are defined upfront.
- Voting results update live (simulated real-time).
- Should be built in 1 hour.
- Stack must use Java (Spring Boot) for the backend and optionally React or plain JS for the frontend.
- ✅ A single poll question (e.g., “Which is better: cats or dogs?”)
- ✅ Two to four voting options
- ✅ Submit vote once per session (via browser cookie or IP check)
- ✅ Show results as percentage bars after voting
- ✅ Clean and mobile-friendly UI
- ✅ Simulate live updates using polling or WebSocket (simple version uses JavaScript polling)