Skip to content

Instantly share code, notes, and snippets.

@jikeytang
Created May 26, 2014 15:07
Show Gist options
  • Save jikeytang/2dff9493143e25ab8463 to your computer and use it in GitHub Desktop.
Save jikeytang/2dff9493143e25ab8463 to your computer and use it in GitHub Desktop.
[ Javascript ] - 20140527-题目1
一个字符串,找出这个字符串的第一对重复的字符
如 abcdefgjikuoa 第一对重复的字符是’a’
如 abcdegfeter 第一对重复的字符 ‘e’
PS:
1. 回复时注意加上下面这句话,才会有语法高亮或格式缩进。
```javascript
// you code
```
2. 粘贴代码时请使用shift+tab,缩进前面的空白。
@styling
Copy link

styling commented May 30, 2014

真是凶啊 没啥写的了

function a (x) {
    var item;
    for(var i = 0; i < x.length; i++){
        if(x.split(x[i]).length > 2) return x[i];
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment