摘要: 例如: 字符串在Python内部的表示是unicode编码,因此,在做编码转换时,通常需要以unicode作为中间编码,即先将其他编码的字符串解码(decode)成unicode,再从unicode编码(encode)成另一种编码。因为从文件读取时,key和都被编码为utf-8,为了查询中文的Key 阅读全文
posted @ 2016-07-08 11:25 xchangcheng 阅读(672) 评论(0) 推荐(0) 编辑
摘要: Given a strings, cutsinto some substrings such that every substring is a palindrome.Return the minimum cuts needed for a palindrome partitioning ofs.E... 阅读全文
posted @ 2015-10-09 10:25 xchangcheng 阅读(107) 评论(0) 推荐(0) 编辑
摘要: Givennxmnon-negative integers representing an elevation map 2d where the area of each cell is1x1, compute how much water it is able to trap after rain... 阅读全文
posted @ 2015-10-07 13:10 xchangcheng 阅读(143) 评论(0) 推荐(0) 编辑
摘要: Givennnon-negative integers representing an elevation map where the width of each bar is1, compute how much water it is able to trap after raining.Exa... 阅读全文
posted @ 2015-10-07 13:09 xchangcheng 阅读(194) 评论(0) 推荐(0) 编辑
摘要: Given a permutation which contains no repeated number, find its index in all the permutations of these numbers, which are ordered in lexicographical o... 阅读全文
posted @ 2015-10-05 13:26 xchangcheng 阅读(183) 评论(0) 推荐(0) 编辑
摘要: Given a string s and a dictionary of words dict, determine if s can be break into a space-separated sequence of one or more dictionary words.ExampleGi... 阅读全文
posted @ 2015-10-04 10:48 xchangcheng 阅读(176) 评论(0) 推荐(0) 编辑
摘要: Given an array with positive and negative integers. Re-range it to interleaving with positive and negative integers.ExampleGiven[-1, -2, -3, 4, 5, 6],... 阅读全文
posted @ 2015-09-09 09:42 xchangcheng 阅读(186) 评论(0) 推荐(0) 编辑
摘要: Find the number Weak Connected Component in the directed graph. Each node in the graph contains a label and a list of its neighbors. (a connected set ... 阅读全文
posted @ 2015-09-01 19:36 xchangcheng 阅读(185) 评论(0) 推荐(0) 编辑
摘要: Design an algorithm and write code to serialize and deserialize a binary tree. Writing the tree to a file is called 'serialization' and reading back f... 阅读全文
posted @ 2015-08-27 17:31 xchangcheng 阅读(168) 评论(0) 推荐(0) 编辑
摘要: Given an integer array, find a continuous rotate subarray where the sum of numbers is the biggest. Your code should return the index of the first numb... 阅读全文
posted @ 2015-08-27 16:19 xchangcheng 阅读(626) 评论(0) 推荐(0) 编辑