原创 leetcode Perform String Shifts

You are given a string s containing lowercase English letters, and a matrix shift, where shift[i] = [direction, amount]:

原创 leetcode 1310. XOR Queries of a Subarray

Given the array arr of positive integers and the array queries where queries[i] = [Li, Ri], for each query i compute the

原创 leetcode 926. Flip String to Monotone Increasing

A string of '0's and '1's is monotone increasing if it consists of some number of '0's (possibly 0), followed by some nu

原创 將numpy.ndarray寫入excel

引言   很多情況下,我們可以將數據結果保存到txt文件中便於後續查看或者再處理,然而爲了進行彙報、論文撰寫等工作,我們將數據放入表格,爲後續整理會提供極大的便利。我們可以利用pandas庫進行numpy.ndarray數據保存到excel

原创 leetcode 1337. The K Weakest Rows in a Matrix

Given a m * n matrix mat of ones (representing soldiers) and zeros (representing civilians), return the indexes of the k

原创 leetcode 215. Kth Largest Element in an Array

Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the

原创 leetcode 303. Range Sum Query - Immutable

Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: Given num

原创 leetcode 1021 Remove Outermost Parentheses

A valid parentheses string is either empty (""), "(" + A + ")", or A + B, where A and B are valid parentheses strings, a

原创 leetcode 82. Remove Duplicates from Sorted List II

Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the origina

原创 leetcode 1309. Decrypt String from Alphabet to Integer Mapping

Given a string s formed by digits ('0' - '9') and '#' . We want to map s to English lowercase characters as follows: Ch

原创 leetcode 1079. Letter Tile Possibilities

You have a set of tiles, where each tile has one letter tiles[i]printed on it.  Return the number of possible non-empty

原创 leetcode 1318 Minimum Flips to Make a OR b Equal to c

Given 3 positives numbers a, b and c. Return the minimum flips required in some bits of a and b to make ( a OR b == c ).

原创 leetcode 1306. Jump Game III

Given an array of non-negative integers arr, you are initially positioned at start index of the array. When you are at i