摘要:
Given a text file file.txt, transpose its content. You may assume that each row has the same number of columns and each field is separated by the ' ' 阅读全文
摘要:
统计words.txt中每个单词出现的次数并排序 解法1: 解法2: 阅读全文
摘要:
Given two strings s and t, write a function to determine if t is an anagram of s. For example,s = "anagram", t = "nagaram", return true.s = "rat", t = 阅读全文
摘要:
Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the 阅读全文
摘要:
确定一个数组中有没有重复的值,有的话返回真 解法1: 用python做这样的题感觉。。好简单啊 解法2: 排序,然后遍历 O(Nlog N) 阅读全文
摘要:
Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrenc 阅读全文
摘要:
统计小于n的素数的个数 如果判断每一个数是不是素数的话,时间会超时,如下 题意要统计素数的个数,那么可以换一种思路,每发现一个素数i,那么i^2,i^2+i...都肯定不是素数 阅读全文
摘要:
转载自leetcode评论区:https://discuss.leetcode.com/topic/30941/here-is-a-10-line-template-that-can-solve-most-substring-problems I will first give the soluti 阅读全文
摘要:
Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). For example,S = "ADOBECOD 阅读全文
摘要:
Given two integers representing the numerator and denominator of a fraction, return the fraction in string format. If the fractional part is repeating 阅读全文
摘要:
Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any positive intege 阅读全文