human
Minimum Number of Bullets required to penetrate all bricks | Function to find the minimum number of bullets required to penetrate all bricks.
Sort the points in ascending order.
Check if there are no points.
Iterate through all the points.
Increase the count.
Return the count.
Driver Code.
Given coordinates of bricks.
Function call"
How can the above be solved in Python?
 Write me a code to minimum Number of Bullets required to penetrate all bricks and the other steps required?
assistant
#Here is code to minimum Number of Bullets required to penetrate all bricks and the other steps required.
 def findMinBulletShots ( points ) :
	for i in range ( len ( points ) ) :
		points [ i ] = points [ i ] [ : : - 1 ]
	points = sorted ( points )
	for i in range ( len ( points ) ) :
		points [ i ] = points [ i ] [ : : - 1 ]
	if ( len ( points ) == 0 ) :
		return 0
	cnt = 1
	curr = points [ 0 ] [ 1 ]
	for j in range ( 1 , len ( points ) ) :
		if ( curr < points [ j ] [ 0 ] ) :
			cnt += 1
			curr = points [ j ] [ 1 ]
	return cnt
if __name__ == ' _ _ main _ _ ' :
	bricks = [ [ 5000 , 900000 ] , [ 1 , 100 ] , [ 150 , 499 ] ]
	print ( findMinBulletShots ( bricks ) )