Tap here to switch tabs
Problem
Submissions

Problem: Maximum Points Inside the Square

Try to solve the Maximum Points Inside the Square problem.

Statement

You are given a two dimensional array points, where points[i] represents the coordinates of the point at index i on a Cartesian plane. You are also given a string s, where s[i] represents the character tag assigned to points[i].

A square is considered valid if:

  1. It is axis aligned and centered at (0,0)(0, 0).

  2. No two points falling inside or on the perimeter of the square have the same character tag in s.

Return the maximum number of points that can be contained inside or on the perimeter of a valid square.

Note:
Points located on the boundary of the square are counted as being inside the square.

Constraints:

  • 1≤1 \leq s.length, points.length ≤105\leq 10^5

  • points[i].length =2= 2

  • −109≤-10^9 \leq points[i][0], points[i][1] ≤109\leq 10^9

  • s.length == points.length

  • points consists of distinct coordinates.

  • s consists only of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Points Inside the Square

Try to solve the Maximum Points Inside the Square problem.

Statement

You are given a two dimensional array points, where points[i] represents the coordinates of the point at index i on a Cartesian plane. You are also given a string s, where s[i] represents the character tag assigned to points[i].

A square is considered valid if:

  1. It is axis aligned and centered at (0,0)(0, 0).

  2. No two points falling inside or on the perimeter of the square have the same character tag in s.

Return the maximum number of points that can be contained inside or on the perimeter of a valid square.

Note:
Points located on the boundary of the square are counted as being inside the square.

Constraints:

  • 1≤1 \leq s.length, points.length ≤105\leq 10^5

  • points[i].length =2= 2

  • −109≤-10^9 \leq points[i][0], points[i][1] ≤109\leq 10^9

  • s.length == points.length

  • points consists of distinct coordinates.

  • s consists only of lowercase English letters.