ARTS #192 | AI 上色 Algorithm 本周选择的算法题是:Minimum Depth of Binary Tree。 impl Solution { pub fn min_depth(root: Option<Rc<RefCell<TreeNode>>>) -> i32 { if root.is_none() { return 0 };... 2023-02-254 min read
ARTS #191 | AI 生成网站图片 Algorithm 本周选择的算法题是:Invert Binary Tree。 use std::rc::Rc; use std::cell::RefCell; impl Solution { pub fn invert_tree(root: Option<Rc<RefCell<TreeNode>>>) -> Option<Rc... 2023-02-187 min read
ARTS #190 | 手工兔兔 Algorithm 本周选择的算法题是:Valid Sudoku。 class Solution: def isValidSudoku(self, board: List[List[str]]) -> bool: table = set() for i in range(len(board)): for j in ... 2023-02-122 min read
ARTS #189 | 元宵烟花 Algorithm 本周选择的算法题是:Zigzag Conversion。 impl Solution { pub fn convert(s: String, num_rows: i32) -> String { if num_rows < 2 { return s; } let num_rows = num_r... 2023-02-053 min read
2023 春节记忆 老家的雪在年三十前就铺满了大地,而在厦门这座南方小城,却百花齐放、暖阳高照。 今年因为小宝宝出生,连续两年没回老家,由于无人带娃,年的记忆就和家里的大宝小宝们交织在一起。 压岁钱 不得不说,现在的红包是越来越好看了: 我小时候可收不到这么好看(长)的红包😌 压岁钱的寓意是辟邪驱鬼,帮助小孩平安过年,并祝愿他们能够在新的一年里平平安安。我家大宝理解了这份寓意,给我们制作了一个... 2023-01-281 min read
ARTS #188 | 新年快乐 Algorithm 本周选择的算法题是:Subarray Sums Divisible by K。 规则 Given an integer array nums and an integer k, return the number of non-empty subarrays that have a sum divisible by k. A subarray is a con... 2023-01-227 min read
ARTS #187 | 喂天鹅 Algorithm 本周选择的算法题是:Longest Path With Different Adjacent Characters。 规则 You are given a tree (i.e. a connected, undirected graph that has no cycles) rooted at node 0 consisting of n nodes numb... 2023-01-157 min read
ARTS #186 | 阳康了 Algorithm 本周选择的算法题是:Maximum Ice Cream Bars。 规则 It is a sweltering summer day, and a boy wants to buy some ice cream bars. At the store, there are n ice cream bars. You are given an array cost... 2023-01-084 min read
ARTS #185 | 圣诞展览 Algorithm 本周选择的算法题是:Walking Robot Simulation II。 规则 A width x height grid is on an XY-plane with the bottom-left cell at (0, 0) and the top-right cell at (width - 1, height - 1). The grid is a... 2022-12-2515 min read
ARTS #184 | 以后就是四口之家了 Algorithm 本周选择的算法题是:Maximum Difference Between Node and Ancestor。 规则 Given the root of a binary tree, find the maximum value v for which there exist different nodes a and b where v = |a.val - b.... 2022-12-163 min read