7 kyu

Maximum Length Difference

866 of 29,598g964

Description:

You are given two arrays a1 and a2 of strings. Each string is composed with letters from a to z. Let x be any string in the first array and y be any string in the second array.

Find max(abs(length(x) − length(y)))

If a1 and/or a2 are empty return -1 in each language except in Haskell (F#) where you will return Nothing (None).

Example:

a1 = ["hoqq", "bbllkw", "oox", "ejjuyyy", "plmiis", "xxxzgpsssa", "xxwwkktt", "znnnnfqknaz", "qqquuhii", "dvvvwz"]
a2 = ["cccooommaaqqoxii", "gggqaffhhh", "tttoowwwmmww"]
mxdiflg(a1, a2) --> 13

Bash note:

  • input : 2 strings with substrings separated by ,
  • output: number as a string
Fundamentals

More By Author:

Check out these other kata created by g964

Stats:

CreatedDec 6, 2015
PublishedDec 6, 2015
Warriors Trained74675
Total Skips15813
Total Code Submissions188181
Total Times Completed29598
Ruby Completions866
Python Completions7586
JavaScript Completions7417
CoffeeScript Completions25
C# Completions1477
Haskell Completions436
Java Completions3408
Clojure Completions281
C++ Completions2002
PHP Completions1235
Crystal Completions33
C Completions924
TypeScript Completions774
F# Completions121
Shell Completions183
OCaml Completions56
Kotlin Completions967
Elixir Completions199
Julia Completions56
R Completions171
Scala Completions300
PowerShell Completions108
Go Completions1271
Nim Completions23
Rust Completions608
Reason Completions7
Racket Completions36
Haxe Completions14
Pascal Completions29
Perl Completions28
D Completions10
COBOL Completions9
Erlang Completions22
Total Stars570
% of votes with a positive feedback rating80% of 3571
Total "Very Satisfied" Votes2487
Total "Somewhat Satisfied" Votes741
Total "Not Satisfied" Votes343
Ad
Contributors
  • g964 Avatar
  • raulbc777 Avatar
  • ParanoidUser Avatar
  • imjasonmiller Avatar
  • lilsweetcaligula Avatar
  • Blind4Basics Avatar
  • Voile Avatar
  • FArekkusu Avatar
  • monadius Avatar
  • hobovsky Avatar
  • xavierguihot Avatar
  • trashy_incel Avatar
  • user8436785 Avatar
  • akar-0 Avatar
Ad