PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/UiPath

Compute Minimum L-Moves on Infinite Grid

Last updated: Mar 29, 2026

Quick Overview

This question evaluates algorithmic problem-solving skills with emphasis on discrete geometry, parity and symmetry reasoning, optimization for shortest-path movement, and careful edge-case handling.

  • Medium
  • UiPath
  • Coding & Algorithms
  • Machine Learning Engineer

Compute Minimum L-Moves on Infinite Grid

Company: UiPath

Role: Machine Learning Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

On an infinite 2D grid, a chess-like piece moves in L-shapes: from (x, y) it can go to (x±1, y± 2) or (x±2, y± 1). Given integer target coordinates (tx, ty) with |tx|, |ty| ≤ 1e9, implement a function minLMoves(tx, ty) that returns the minimum number of moves needed to reach (tx, ty) starting from (0, 0). Exploit symmetry to optimize your solution and handle edge cases carefully. Explain your algorithm, prove correctness intuitively, and analyze time and space complexity.

Quick Answer: This question evaluates algorithmic problem-solving skills with emphasis on discrete geometry, parity and symmetry reasoning, optimization for shortest-path movement, and careful edge-case handling.

Related Interview Questions

  • Implement cocktail shaker sort and analyze - UiPath (Medium)
  • Compute longest distinct substring, case-insensitive - UiPath (Medium)
UiPath logo
UiPath
Aug 7, 2025, 12:00 AM
Machine Learning Engineer
Technical Screen
Coding & Algorithms
2
0

On an infinite 2D grid, a chess-like piece moves in L-shapes: from (x, y) it can go to (x±1, y± 2) or (x±2, y± 1). Given integer target coordinates (tx, ty) with |tx|, |ty| ≤ 1e9, implement a function minLMoves(tx, ty) that returns the minimum number of moves needed to reach (tx, ty) starting from (0, 0). Exploit symmetry to optimize your solution and handle edge cases carefully. Explain your algorithm, prove correctness intuitively, and analyze time and space complexity.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More UiPath•More Machine Learning Engineer•UiPath Machine Learning Engineer•UiPath Coding & Algorithms•Machine Learning Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.