Strings Mix
Last updated
Was this helpful?
Last updated
Was this helpful?
getting lowercase character via RegExp
iterest each character with initial value Map
if key exist in map add value with 'arraySequence'. (arraySequence is for identifier for distinguish. because we need calculate rank)
set max value for format (in this case arraySequence will '1', '2',)
set comparision result (1 || 2 || '=')
return map
call collectData function with two input
convert process-1 to array
sorting
if a.max < b.max return 1 (change) because ordering DESC
if a.max equal with b.max
if a.greater > b.greater should be change because when max value same sequence 1 should be first.
*and the reason use parseInt(a[1].greater) || 3
because when trying parseInt if greater is '=' should be go to last
if a,b greater same ordering lexicographically
filtering process-3 who less than 1
iterate process-4 and convert to format
Convert process-5 to one string