随笔分类 - LeetCode
摘要:Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of
阅读全文
摘要:1 public static void main(String[] args) { 2 char[] s ={'3', '2', '3', '^', '3','^', '1'}; 3 eatgold(s); 4 } 5 6 private static void eatgold(char[] value) { 7 ...
阅读全文
摘要:Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n]
阅读全文
摘要:Given a word, you need to judge whether the usage of capitals in it is right or not. We define the usage of capitals in a word to be right when one of
阅读全文
摘要:The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, calcul
阅读全文
摘要:Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: Example 1: Exa
阅读全文
摘要:Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the
阅读全文
摘要:Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters. This
阅读全文
摘要:Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1. Examples: 分析:找出字符串中第一次出现且不重复的字符,返回
阅读全文
摘要:在链接列表中删除节点. 编写一个函数来删除单链表中的一个节点(除了尾部),只提供对该节点的访问.。假设链表是1 - > 2 - > 3 > 4,并给出了具有值为3的节点, 链表应该成为1 - > 2 - > 4
阅读全文
摘要:Find the sum of all left leaves in a given binary tree. 左树的值(9+15=24)
阅读全文

浙公网安备 33010602011771号