Sort by

recency

|

41 Discussions

|

  • + 0 comments

    def solve(steps): # Write your code here first = True for i in steps: if first: minrow = i[0] mincol = i[1] first = False else: if i[0] < minrow: minrow = i[0] if i[1] < mincol: mincol = i[1] return (minrow * mincol)

  • + 1 comment

    In Kotlin, I got an overflow error in some test cases. I needed to change the return type for Long to make it pass.

  • + 0 comments
    #include <iostream>
    using namespace std;
    void rectangularGame(int n)
    {
        unsigned long long int a,b, minA, minB;
        for(int i=0; i<n; i++)
        {
            cin>>a>>b;
            if(i==0)
            {
                minA=a;
                minB=b;
            }
            if(a<minA)
            {
                minA=a;
            }
            if(b<minB)
            {
                minB=b;
            }
        }
        cout<<minA*minB;
    }
    int main()
    {
        int n;
        cin>>n;
        rectangularGame(n);
        return 0;
    }
    
  • + 0 comments

    Java :

    import java.util.Scanner;
    
    public class Solution {
        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int n = sc.nextInt();
            int a = Integer.MAX_VALUE, b = Integer.MAX_VALUE;
            while (n-- > 0) {
                a = Math.min(a, sc.nextInt());
                b = Math.min(b, sc.nextInt());
            }
            
            System.out.println(1L * a * b);
        }
    }
    
  • + 0 comments

    python code def solve(steps): x = [] y = [] for i in range(n): x.append(steps[i][0]) y.append(steps[i][1]) x1 = min(x) y1 = min(y) result = x1*y1 return result