Sort by

recency

|

190 Discussions

|

  • + 0 comments

    My solution: !/bin/bash

    contador=0 auxiliar=""

    read entrance

    read -a entrance2

    for(( i=0; i<"You can't use 'macro parameter character #' in math mode{#entrance2[@]}"; l++ )); do if(("{entrance2[l]}"));then contador=$((contador+1)) fi

    done
    
    if(("$contador" == "1")); then
        auxiliar="${entrance2[i]}"
        break
    fi
    

    done

    echo "$auxiliar"

  • + 1 comment
    awk '  
    BEGIN { res = 0 }  
    
    NR == 2 {  
        for (i = 1; i <= NF; i++) {  
        el = $i  
        if (el in arr) {  
              res -= el  
          } else {  
              arr[el] = el  
              res += el  
          }  				
      }  		
      print res  
    }'
    
  • + 0 comments

    read n read -a array

    tmp=0 for value in "((tmp^value)) done echo $tmp

  • + 0 comments
    read N
    
    # Read the space-separated integers into an array and find the unique integers with their counts
    
    echo "$(< /dev/stdin)" | tr ' ' '\n' | sort | uniq -u
    
  • + 1 comment
    read n
    read -a arr
    
    temp=${arr[0]}
    for n in ${arr[@]:1}; do temp=$(( temp ^ n )); done
    
    echo $temp