Building My Own AI Developer Platform ā Ep 1: The idea
ā Runtime tested ā the solution passes every example case. š Full written solution: https://interview-kit-fe.vercel.app/aidevtool-ep1-the-idea š» Code on GitHub: https://github.com/timepasshub2539-hue/leetcode-python/tree/main/aidevtool-ep1-the-idea Chapters: 0:00 4 Tools, Zero Shared Memory 0:19 One App, Not Four 0:41 What This Platform Actually Has To Do 0:57 Four Pillars 1:16 The Rough Shape 1:29 The Stack, Roughly 1:44 Why Not Just Use Existing Tools 2:06 Step 1: Give the Series a Memory 2:29 Step 2: Know Which Episode You're On 2:40 Step 3: Record the Episode 2:52 Putting It Together 3:04 Running It 3:12 The Biggest Risk 3:26 Where This Series Goes 3:37 One Way to Extend This 3:51 See You in Episode Two 4:18 Watch It Actually Run Watch next: - Smallest Palindromic Rearrangement II ā š” Intermediate (2/3) ā LeetCode Daily Python Solution (stop building the whole string): https://youtu.be/AX8_qJPNXpA - Building Your Own Mistakes #shorts: https://youtu.be/WFIvzDKhbWI - Mutate A List Mid-Loop? You'll Skip An Item #shorts: https://youtu.be/upX6Tr0r07Y
The solution
import sqlite3, argparse
def init_series_table(db_path="series_state.db"):
conn = sqlite3.connect(db_path)
conn.execute("""CREATE TABLE IF NOT EXISTS series_episodes(
series TEXT, ep_num INTEGER, title TEXT, notes TEXT,
PRIMARY KEY(series, ep_num))""")
conn.commit()
return conn
def next_episode(conn, series):
row = conn.execute(
"SELECT MAX(ep_num) FROM series_episodes WHERE series=?",
(series,)).fetchone()
return (row[0] or 0) + 1
def add_episode(conn, series, title, notes):
ep = next_episode(conn, series)
conn.execute("INSERT INTO series_episodes VALUES (?,?,?,?)",
(series, ep, title, notes))
conn.commit()
return ep
if __name__ == "__main__":
p = argparse.ArgumentParser()
p.add_argument("--buildseries")
p.add_argument("--title")
p.add_argument("--notes", default="")
args = p.parse_args()
conn = init_series_table()
ep = add_episode(conn, args.buildseries, args.title, args.notes)
print(f"Recorded episode {ep} of {args.buildseries}")Ready to try it yourself? Solve General problems with instant feedback in the practice sandbox.
Practice now ā


