Logic for 132 Pattern


  • 0
    J
    Checking for every i from 2 to n-1
    	min1 = minimum of numbers from 1 to i-1
    	if(min1 < a[i])
    		min2 = minimum of numbers from i+1 to n greater than min1
    		if(min2 < a[i])
    			return true
    return false
    

Log in to reply
 

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