Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Implement a function to solve constrained optimization problems using the Lagrange multiplier method.

Hard

Problem Statement

Implement a function to solve constrained optimization problems using the Lagrange multiplier method.

Sample Input

Objective Function: f(x, y) = x^2 + y^2 
 Constraint: g(x, y) = x + y - 1 = 0

Sample Output

Optimal Solution: x = -3.802555e+42 , y = -2.459376e+42

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
lagrange_optimization <- function(f, g, start) { # Your logic here } # Call the function
Log in or sign up to run or submit your code.Log inSign up
Input
Objective Function: f(x, y) = x^2 + y^2 
 Constraint: g(x, y) = x + y - 1 = 0
Expected Output
Optimal Solution: x = -3.802555e+42 , y = -2.459376e+42