Skip to content

Instantly share code, notes, and snippets.

View DC-Shi's full-sized avatar
💭
[doge]

Daochen Shi DC-Shi

💭
[doge]
View GitHub Profile
@DC-Shi
DC-Shi / color256.sh
Last active February 7, 2018 04:11 — forked from yonchu/color256.sh
zsh/bashで256色のカラーパレットを表示
#!/bin/sh
#
# 256色のカラーパレットを表示する
# bash と zsh にて実行可能
#
# dc-shi: 更改了颜色表达方式,第一行为标准16色,
# 之后6*6*6的彩色
# 最后是24阶灰度
# 暂时未对zsh做更改
@DC-Shi
DC-Shi / RemoveMultipleSpaces.cs
Created March 28, 2012 17:30 — forked from Ninputer/RemoveMultipleSpaces.cs
模拟微面试之去空格
//请实现下面的函数,输入参数baseStr是一个(可以更改的)字符串,请将其中所有连续出现的多个空格都替换成一个空格,单一空格需保留。
//请直接使用baseStr的空间,如需开辟新的存储空间,不能超过o(N)(注意是小o,N是字符串的长度)。返回值是替换后的字符串的长度。
//样例代码为C#,但可以使用任何语言。如需使用任何库函数,必须同时给出库函数的实现。
class Program
{
public static int RemoveMultipleSpaces(char[] baseStr)
{
if (baseStr == null) return 0;
int idx = 0, pointer = 0; // 循环变量和指向缩减过的位置;
bool isSpaceEntered = false;