Solution


  • 0
    L

    I don't know why the difficulty is "Hard"

    Go through the array, and compare the minimal value with every element, print it

    class Solution {
    public:
        int findMin(vector<int>& nums) {
            int mn=1e9;
            for(int i=0;i<nums.size();i++) mn=min(mn,nums[i]);
            return mn;
        }
    };
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.