File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ /* ==============================================================================
2
+ * 功能描述:FindDifferenceSln
3
+ * 创 建 者:gz
4
+ * 创建日期:2017/5/9 13:23:46
5
+ * ==============================================================================*/
6
+ using System ;
7
+ using System . Collections . Generic ;
8
+ using System . Linq ;
9
+ using System . Text ;
10
+
11
+ namespace HashTable . Lib
12
+ {
13
+ /// <summary>
14
+ /// FindDifferenceSln
15
+ /// </summary>
16
+ public class FindDifferenceSln
17
+ {
18
+ public char FindTheDifference ( string s , string t )
19
+ {
20
+ int [ ] hash = new int [ 123 ] ; //97~122
21
+ foreach ( var ch in s )
22
+ hash [ Convert . ToInt32 ( ch ) ] ++ ;
23
+ foreach ( var ch in t )
24
+ {
25
+ int tmp = Convert . ToInt32 ( ch ) ;
26
+ hash [ tmp ] -- ;
27
+ if ( hash [ tmp ] < 0 )
28
+ return ch ;
29
+ }
30
+ return ' ' ;
31
+ }
32
+
33
+ }
34
+ }
You can’t perform that action at this time.
0 commit comments