Minimum Element

    0

    0

    Aakanksha Priya

    Find minimum elements from a list of elements

    def getMin(arr, n):
        # If there is only one element then return it as min
        if n == 1:
            min = arr[0]
            return min
        # If there are more than one elements, then initialize min
        min = arr[0]
        for i in range(1, n):
            if arr[i] < min:
                min = arr[i]
        return min
    # Driver Code
    if __name__ == "__main__":
        arr = [10, 11, 45, 89, 33, 30]
        arr_size = 6
        min = getMin(arr, arr_size)
        print("Minimum element is", min)
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    Legal
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.