public class Solution {
public IList<IList<string>> FindDuplicate(string[] paths) {
Dictionary<string, List<string>> map = new Dictionary<string, List<string>>();
foreach (string path in paths)
{
string[] tokens = path.Split(' ');
for (int i = ; i < tokens.Length; i++)
{
string file = tokens[i].Substring(, tokens[i].IndexOf('(')); var begin = tokens[i].IndexOf('(') + ;
var end = tokens[i].IndexOf(')') - begin; string content = tokens[i].Substring(begin, end);
if (!map.ContainsKey(content))
{
map.Add(content, new List<string>());
}
map[content].Add(tokens[] + "/" + file);
}
}
IList<IList<string>> list = new List<IList<string>>();
var list2 = map.Values.Where(e => e.Count > ).ToList();
foreach (var l2 in list2)
{
list.Add(l2);
} return list;
}
}

https://leetcode.com/problems/find-duplicate-file-in-system/#/solutions

leetcode609的更多相关文章

  1. [Swift]LeetCode609. 在系统中查找重复文件 | Find Duplicate File in System

    Given a list of directory info including directory path, and all the files with contents in this dir ...

随机推荐

  1. 【lightoj-1039】A Toy Company(BFS)

    The toy company "Babies Toys" has hired you to help develop educational toys. The current ...

  2. hdu4619

    题解: 最大独立集问题 显然对于每一对交叉的建边 然后求出最大独立集 最大独立集=n-最大匹配 代码: #include<cstdio> #include<cmath> #in ...

  3. 获取Activity的返回参数

    一.新建一个空的工程 二.在主界面中添加一个按钮和一个TextView组件 三.新建一个空的activity,命名为TheAty,并添加一个按钮和一个EditText组件 四.重写TheAty的源代码 ...

  4. java中商业数据计算时用到的类BigDecimal和DecimalFormat

    1.引言 借用<Effactive Java>这本书中的话,float和double类型的主要设计目标是为了科学计算和工程计算.他们执行二进制浮点运算,这是为了在广域数值范围上提供较为精确 ...

  5. 你不知道的sticky

    position:sticky,Chrome新版本已经做了支持.sticky的中文翻译是“粘性的”,position:sticky表现也符合这个粘性的表现.基本上,可以看出是position:rela ...

  6. pg_rewind 源端时间线发生改变 同步失败

    master-standby情况下,发生如下行为: 1.master停掉后,standby做为新的master(可能存在部分事物没有同步到standby中). 2.新master运行过程中出错,进行恢 ...

  7. Qt5学习笔记——QRadioButton与QbuttonGroup

    [我是小标题:使用QToolButton实现radio button功能.] QRadioButton是什么?  下图是Windows系统中典型的radio button显示效果.    QRadio ...

  8. Leetcode 1015. Smallest Integer Divisible by K

    思路显然是暴力枚举. 但是两个问题: 1.当1的位数非常大时,模运算很费时间,会超时. 其实每次不用完全用'11111...'来%K,上一次的余数*10+1后再%K就行. 证明: 令f(n)=1111 ...

  9. prefixfree.min.js 的用途

    简单而言,这东西就是自动加前缀的,在link中,或是style中,或是dom元素的style中书写CSS3 code,或是jQuery .css()方法此脚本会自动补上需要的前缀,让响应的浏览器支持该 ...

  10. wordpress 使用固定链接

    官方文档 无插件移除url中category 目录前缀 设置 >> 固定链接,设置固定链接为自定义为: /%category%/%postname%/或者/%category%/%post ...