146. LRU Cache
題目 LeetCode: 146. LRU Cache Design a data structure that follows the constraints of a Least Recently Used (LRU) cache. Implement the LRUCache class: LRUCache(int capacity) Initialize the LRU cache with positive size capacity. int get(int key) Return the value of the key if the key exists, otherwise return -1. void put(int key, int value) Update the value of the key if the key exists. Otherwise, add the key-value
1694B. Paranoid String
題目 Codeforces: 1694B: Paranoid String Let’s call a binary string 𝑇 of length 𝑚 indexed from 1 to 𝑚 paranoid if we can obtain a string of length 1 by performing the following two kinds of operations 𝑚−1 times in any order : Select any substring of 𝑇 that is equal to 01, and then replace it with 1. Select any substring of 𝑇 that is equal
1694A. Creep
題目 Codeforces: 1694A: Creep Define the score of some binary string 𝑇 as the absolute difference between the number of zeroes and ones in it. (for example, 𝑇= 010001 contains 4 zeroes and 2 ones, so the score of 𝑇 is $|4−2|=2$). Define the creepiness of some binary string 𝑆 as the maximum score among all of its
1693A. Directional Increase
題目 Codeforces: 1693A: Directional Increase We have an array of length n. Initially, each element is equal to 0 and there is a pointer located on the first element. We can do the following two kinds of operations any number of times (possibly zero) in any order: If the pointer is not on the last element, increase the element the pointer is currently on by 1. Then move it
2306. Naming a Company
題目 LeetCode Problem You are given an array of strings ideas that represents a list of names to be used in the process of naming a company. The process of naming a company is as follows: Choose 2 distinct names from ideas, call them ideaA and ideaB. Swap the first letters of ideaA and ideaB with each other. If both of the new names are not found in the
2305. Fair Distribution of Cookies
題目 LeetCode Problem You are given an integer array cookies, where cookies[i] denotes the number of cookies in the ith bag. You are also given an integer k that denotes the number of children to distribute all the bags of cookies to. All the cookies in the same bag must go to the same child and cannot be split up. The unfairness of a distribution is defined as the
2289. Steps to Make Array Non-decreasing
題目 LeetCode Problem You are given a 0-indexed integer array nums. In one step, remove all elements nums[i] where nums[i - 1] > nums[i] for all 0 < i < nums.length. Return the number of steps performed until nums becomes a non-decreasing array. 說明 這題我在看完 Hint 後才想出來,所以紀錄一下。 一個元素
貓空攝影
纜車 樟樹步道 貓 貓空起源? 橋旁的狸貓茶壺?
西門町攝影
萬年商業大樓 吉天元拉麵 「入口」 紅樓
2020 回顧與新年希望
2020 回顧與新年希望 2020 年將近尾聲,是時候對這一年做點總結,並且準備下一年的目標了。 Appier 在這間公司待超過一年了,也開始接觸到一些比較緊急的任務。 運動