[演算法題目] Node Depths
The distance between a node in a Binary Tree and the tree’s root is called the node’s depth. Write a function that takes in a Binary Tree and returns the sum of its nodes’ depths……
The distance between a node in a Binary Tree and the tree’s root is called the node’s depth. Write a function that takes in a Binary Tree and returns the sum of its nodes’ depths……
Write a function that takes in an integer n and returns the nth Fibonacci number…
You’re given a Node class that has a name and an array of optional children nodes. When put together, nodes form an acyclic tree-like structure…
Write a function that takes in a non-empty array of integers that are sorted in ascending order and returns a new array o fthe same length with…
這篇文章的緣由是電腦上 Windows 的安全性頁面呈現空白,但又很不想裝第三方防毒軟體。這台出問題的電腦是二手的,原本就有裝 Windows ,似乎是某公家機關或公司退役下來的電腦……
Given two arrays of integers, compute the pair of values (one value in each array) with the smallest (non-negative) difference…
Given an integer array array, return true if the given array is monotonic, or false otherwise.
這幾天在整理自己經營的網站時,一直在思考重新分配空間的可能性。到目前為止手上有在維護的網站包含這裡只有三個,但三個面向都不盡相同。一個是希望走技術性隨筆…
身為一個愛看各種動畫的人來說,絕對不能錯過宣稱有大量手稿的展吧!記得高畑勲2018年過世時,相當多動畫迷非常震驚。而我反而是高畑勲過世後,才慢慢認識他的作品。除了螢火蟲之墓是小時候看的之外,其他幾乎沒什麼印象。這次的展覽是一個契機,讓我再次重新認識高畑勳這個日本動畫巨匠……
搞笑諾貝爾獎(Ig Nobel Prize)是由美國的科學雜誌《不可思議研究年報》主編 Marc Abrahams 於1991年創立,名字由來是「ignoble」這個詞,有令人感到羞恥的意思。相對於諾貝爾獎的高度學術性質帶來的嚴肅感,搞笑諾貝爾獎提供了較為輕鬆及幽默的角度看科學這檔事……
You’re given a non-empty array of positive integers representing the amounts of time that specific queries take to execute…
最近撥了兩個週末去看「我們的『經』驗」特展,相當有意思。這個特展集結了各種月經故事,一共有15個展間,標榜沒有絕對的動線,讓你照著自己的節奏認識月經這回事……
Write a function that takes in a Binary Tree and inverts it. In other words, the function should swap every left node in the tree for its corresponding right node…
普立茲獎(Pulitzer Prize)可以說是全球新聞界的最高榮譽,喜歡攝影或是看國際新聞的人,一定都有聽過這個獎項。不過普立茲獎的作品會為人所知,通常是來自於較為負面的新聞為主,若隨便問一個人記得的普立茲獎,通常都是和戰爭、災難有關……
Given two binary strings a and b, return their sum as a binary string……
Given an array of pairs representing the teams that have competed against each other and an array containing the results of each competition, write a function that returns the winner of the tournament……
Write a function that returns the maximum possible total speed or the minimum possible total speed of all of the tandem bicycles being ridden based on an input parameter……
藍白拖愛好者,一事無成話偏多