-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalgo119.cs
41 lines (35 loc) · 1.17 KB
/
algo119.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace HelloWorld
{
class Program
{
public static int Mxdiflg(string[] a1, string[] a2)
{
if (a1 == null || a1.Length == 0 || a2 == null || a2.Length == 0)
{ return -1; }
List<int> numsa1 = new List<int>();
List<int> numsa2 = new List<int>();
foreach (var item in a1)
{
numsa1.Add(item.Length);
}
foreach (var item in a2)
{
numsa2.Add(item.Length);
}
int res1 = numsa1.Max() - numsa2.Min();
int res2 = numsa2.Max() - numsa1.Min();
return res1 > res2 ? res1 : res2;
}
static void Main(string[] args)
{
string[] s1 = ["hoqq", "bbllkw", "oox", "ejjuyyy", "plmiis", "xxxzgpsssa", "xxwwkktt", "znnnnfqknaz", "qqquuhii", "dvvvwz"];
string[] s2 = ["cccooommaaqqoxii", "gggqaffhhh", "tttoowwwmmww"];
Console.WriteLine(Mxdiflg(s1, s2));
}
}
}