无题
现在离家正好四个星期,匹村的温度像过山车,还好我没有感冒。
现在离家正好四个星期,匹村的温度像过山车,还好我没有感冒。
舰C游戏不允许非日本ip访问,然而在国内用代理访问经常会偶遇猫神。我现在即使在一个没有墙的地方,距离日本却隔了半个地球,用我的服务器也总是狂猫不止。没办法就只能琢磨琢磨直连了。
注意⚠️:由于舰C本身就是禁止非日本ip访问,使用直连方法可能会有不可预估的风险,包括但不限于封号等后果。如果担心这个问题请全程代理。
准备工作:一个可用的日本代理,如ss。不要用全局vpn。
其实也可以使用改hosts的方法来使用反向代理服务器实现直连,但是反代不是这篇文章的内容,所以请自行搜索。这篇文章的方法适合手上有代理,但是连接不是很稳定的玩家。
Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not.
You need to merge them into a new binary tree. The merge rule is that if two nodes overlap, then sum node values up as the new value of the merged node. Otherwise, the NOT null node will be used as the node of new tree.
Example 1:
1 | Input: |
Note: The merging process must start from the root nodes of both trees.
You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traversing way.
The null node needs to be represented by empty parenthesis pair “()”. And you need to omit all the empty parenthesis pairs that don’t affect the one-to-one mapping relationship between the string and the original binary tree.
Example 1:
1 | Input: Binary tree: [1,2,3,4] |
Example 2:
1 | Input: Binary tree: [1,2,3,null,4] |
Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they would compete for water and both would die.
Given a flowerbed (represented as an array containing 0 and 1, where 0 means empty and 1 means not empty), and a number n, return if n new flowers can be planted in it without violating the no-adjacent-flowers rule.
Example 1:
1 | Input: flowerbed = [1,0,0,0,1], n = 1 |
Example 2:
1 | Input: flowerbed = [1,0,0,0,1], n = 2 |
Note:
Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k.
Example 1:
1 | Input:nums = [1,1,1], k = 2 |
Note:
A zero-indexed array A consisting of N different integers is given. The array contains all integers in the range [0, N - 1].
Sets S[K] for 0 <= K < N are defined as follows:
S[K] = { A[K], A[A[K]], A[A[A[K]]], … }.
Sets S[K] are finite for each K and should NOT contain duplicates.
Write a function that given an array A consisting of N integers, return the size of the largest set S[K] for this array.
Example 1:
1 | Input: A = [5,4,0,3,1,6,2] |
Note:
Given a sorted array consisting of only integers where every element appears twice except for one element which appears once. Find this single element that appears only once.
Example 1:
1 | Input: [1,1,2,3,3,4,4,8,8] |
Example 2:
1 | Input: [3,3,7,7,10,11,11] |
Note: Your solution should run in O(log n) time and O(1) space.
Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite restaurants represented by strings.
You need to help them find out their common interest with the least list index sum. If there is a choice tie between answers, output all of them with no order requirement. You could assume there always exists an answer.
Example 1:
1 | Input: |
Example 2:
1 | Input: |
Note:
Given an m * n matrix M initialized with all 0’s and several update operations.
Operations are represented by a 2D array, and each operation is represented by an array with two positive integers a and b, which means M[i][j]
should be added by one for all 0 <= i < a and 0 <= j < b.
You need to count and return the number of maximum integers in the matrix after performing all the operations.
Example 1:
1 | Input: |
Note: