问题
删除一个字符串中连续超过一次的空格。
解决(Python)
#! /usr/bin/env python
#coding:utf-8
def del_space(string):
split_string = string.split(" ") #以空格为分割,生成list,list中如果含有空格,则该空格是连续空格中的后一个
string_list =...
分类:
其他好文 时间:
2014-06-16 11:21:52
阅读次数:
204
题目链接Problem discriptionGiven two sorted integer
arrays A and B, merge B into A as one sorted array.Note:You may assume that A
has enough space (size t...
分类:
其他好文 时间:
2014-06-16 11:12:36
阅读次数:
192
Question:Given a stringsand a dictionary of
wordsdict, determine ifscan be segmented into a space-separated sequence of one
or more dictionary words.F...
分类:
其他好文 时间:
2014-06-16 07:32:47
阅读次数:
186
Given a linked list, return the node where the cycle begins. If there is no cycle, return null.
Follow up:
Can you solve it without using extra space?
思路:由【Leetcode】Linked
List Cycle可知,利用一快一慢...
分类:
其他好文 时间:
2014-06-15 14:23:38
阅读次数:
288
Given a sorted array, remove the duplicates in place such that each element appear only onceand return the new length.Do not allocate extra space for ...
分类:
其他好文 时间:
2014-06-14 16:59:58
阅读次数:
221
Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Follow up: Can you solve it without using extra space?比...
分类:
其他好文 时间:
2014-06-14 15:48:59
阅读次数:
217
Follow up for "Unique Paths":
Now consider if some obstacles are added to the grids. How many unique paths would there be?
An obstacle and empty space is marked as 1 and 0 respectively
in the...
分类:
其他好文 时间:
2014-06-14 12:02:12
阅读次数:
229
Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (i...
分类:
其他好文 时间:
2014-06-14 08:52:31
阅读次数:
265
Linked List Cycle:Given a linked list, determine if
it has a cycle in it.Follow up:Can you solve it without using extra
space?解题分析:大致思想就是设置两个指针,一个指针每次...
分类:
其他好文 时间:
2014-06-13 14:41:54
阅读次数:
238