文件名称:Leetcode:我的leetcode记录
文件大小:44KB
文件格式:ZIP
更新时间:2024-04-09 05:04:46
Java
#Leetcode我的leetcode记录 ## 1。从有序数组中删除重复项 public static int removeDuplicates( int [] nums) { int i = 0 ; for ( int n : nums) if (i == 0 || n > nums[i - 1 ]) nums[i ++ ] = n; return i; } 解题思路:用一遍循环完成。i为下一个非重复元素放置在数组中的位置。执行逻辑为:数组中的第一个元素不变,i ++,然后开始比较多个中后面的元素n与上## 2。一个非重复元素nums [i-1],因为副本是升序,所以只要n> nums [i-1]就说明n不是重复的,就可以把n放到相应位置,然后循环完成。 Maximum Subarray问题描述:定义一个整体的副本,从中寻
【文件预览】:
Leetcode-java
----190.reverse-bits.java(373B)
----26.remove-duplicates-from-sorted-array.java(342B)
----111.minimum-depth-of-binary-tree.java(792B)
----268.missing-number.java(320B)
----1.two-sum.java(611B)
----345.reverse-vowels-of-a-string.java(930B)
----160.intersection-of-two-linked-lists.java(1KB)
----69.sqrt-x.java(219B)
----290.word-pattern.java(511B)
----112.path-sum.java(1KB)
----141.linked-list-cycle.java(662B)
----README.md(10KB)
----118.pascals-triangle.java(1KB)
----191.number-of-1-bits.java(458B)
----292.nim-game.java(294B)
----257.binary-tree-paths.java(1KB)
----53.maximum-subarray.java(362B)
----219.contains-duplicate-ii.java(553B)
----136.single-number.java(488B)
----303.range-sum-query-immutable.java(553B)
----401.binary-watch.java(796B)
----278.first-bad-version.java(702B)
----66.plus-one.java(1KB)
----404.sum-of-left-leaves.java(1KB)
----20.valid-parentheses.java(2KB)
----119.pascals-triangle-ii.java(458B)
----392.is-subsequence.java(761B)
----27.remove-element.java(306B)
----350.intersection-of-two-arrays-ii.java(1KB)
----203.remove-linked-list-elements.java(936B)
----349.intersection-of-two-arrays.java(972B)
----217.contains-duplicate.java(491B)
----28.implement-str-str.java(877B)
----21.merge-two-sorted-lists.java(1KB)
----283.move-zeroes.java(596B)
----374.guess-number-higher-or-lower.java(907B)
----101.symmetric-tree.java(923B)
----9.palindrome-number.java(399B)
----168.excel-sheet-column-title.java(909B)
----100.same-tree.java(833B)
----121.best-time-to-buy-and-sell-stock.java(477B)
----108.convert-sorted-array-to-binary-search-tree.java(1KB)
----193.valid-phone-numbers.java(0B)
----171.excel-sheet-column-number.java(424B)
----67.add-binary.java(2KB)
----367.valid-perfect-square.java(545B)
----389.find-the-difference.java(440B)
----172.factorial-trailing-zeroes.java(335B)
----155.min-stack.java(1KB)
----125.valid-palindrome.java(886B)
----7.reverse-integer.java(402B)
----206.reverse-linked-list.java(804B)
----58.length-of-last-word.java(594B)
----225.implement-stack-using-queues.java(2KB)
----83.remove-duplicates-from-sorted-list.java(816B)
----235.lowest-common-ancestor-of-a-binary-search-tree.java(1KB)
----13.roman-to-integer.java(3KB)
----263.ugly-number.java(615B)
----204.count-primes.java(610B)
----242.valid-anagram.java(557B)
----205.isomorphic-strings.java(674B)
----383.ransom-note.java(725B)
----258.add-digits.java(672B)
----344.reverse-string.java(342B)
----202.happy-number.java(744B)
----234.palindrome-linked-list.java(1KB)
----326.power-of-three.java(359B)
----104.maximum-depth-of-binary-tree.java(699B)
----167.two-sum-ii-input-array-is-sorted.java(491B)
----231.power-of-two.java(480B)
----88.merge-sorted-array.java(993B)
----342.power-of-four.java(385B)
----35.search-insert-position.java(779B)
----226.invert-binary-tree.java(1KB)
----122.best-time-to-buy-and-sell-stock-ii.java(1023B)
----14.longest-common-prefix.java(924B)
----232.implement-queue-using-stacks.java(2KB)
----70.climbing-stairs.java(434B)
----228.summary-ranges.java(697B)
----169.majority-element.java(446B)
----237.delete-node-in-a-linked-list.java(414B)
----387.first-unique-character-in-a-string.java(782B)
----110.balanced-binary-tree.java(901B)