Minimal numbers of three lists at same position: Difference between revisions
Content added Content deleted
No edit summary |
No edit summary |
||
Line 2: | Line 2: | ||
;Task: |
;Task: |
||
<br>Let gine three lists: |
|||
<br>list1 = [9,18,27,2,65,43,78,11,2] |
<br>list1 = [9,18,27,2,65,43,78,11,2] |
||
<br>list2 = [2,27,36,1,14,89,25,9,15] |
<br>list2 = [2,27,36,1,14,89,25,9,15] |
Revision as of 15:51, 22 November 2021
Minimal numbers of three lists at same position is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
- Task
Let gine three lists:
list1 = [9,18,27,2,65,43,78,11,2]
list2 = [2,27,36,1,14,89,25,9,15]
list3 = [1,45,78,5,11,95,14,25,9]
Let create minList which contain minimal number of three lists at same position.
Ring
<lang ring> see "working..." + nl
list1 = [9,18,27,2,65,43,78,11,2] list2 = [2,27,36,1,14,89,25,9,15] list3 = [1,45,78,5,11,95,14,25,9] list = [] minList = [] len = len(list1)
for n = 1 to len
add(minList,list1[n]) add(minList,list2[n]) add(minList,list3[n]) minList = sort(minList) min = minList[1] add(list,min) minList = []
next
showArray(list)
see nl + "done..." + nl
func showArray(array)
txt = "" see "[" for n = 1 to len(array) txt = txt + array[n] + "," next txt = left(txt,len(txt)-1) txt = txt + "]" see txt
</lang>
- Output:
working... [1,18,27,1,11,43,14,9,2] done...