[Fortinet] OA 2025 start – 12 Mar (generic)
  1. Student's Major

A university maintains data on students and their majors in three tables: STUDENTS, MAJORS, and REGISTER. The university needs a list of STUDENT_NAME and MAJOR_NAME. Sort the list by STUDENT_ID and return the first 20 records.

Table Schema

STUDENTS

NameTypeDescription
STUDENT_IDIntegerThe ID of a student. This is the primary key.
STUDENT_NAMEStringThe name of the student.
STUDENT_AGEIntegerThe age of the student.

MAJORS

NameTypeDescription
MAJOR_IDIntegerThe ID of a major. This is the primary key.
MAJOR_NAMEStringThe name of a major.

REGISTER

NameTypeDescription
STUDENT_IDIntegerThe ID of a student. This is a foreign key.
MAJOR_IDIntegerThe ID of a major. This is a foreign key.

  1. Java: Braces

Given a list of strings of bracket characters {}, determine if the string of brackets is balanced under the following conditions:

  1. It is the empty string.
  2. If strings a and b are balanced, then ab is balanced.
  3. If string a is balanced, then {a} is balanced.

Write a class that determines whether the brackets in each string are balanced and returns true if the string is balanced.

Example 0
s = ["{}", "{}", "{{}}"]

  • s[0] exhibits condition 2 above. {} and {} are balanced, so "{}{}" is balanced. Return true.
  • s[1] exhibits condition 3 above. {} is balanced, so "{{}}" is balanced. Return true.
  • s[2] exhibits condition 3 above. {} is balanced, so "{{}}" is balanced. Return true.

Example 1
s = ["{", "{}}", "{{"]

  • s[0] = "{" is an unbalanced string due to the open {. Return false.
  • s[1] = "{}}" is an unbalanced string due to } before { has been closed. Return false.
  • s[2] = "{{" is an unbalanced string because neither } is closed. Return false.

  1. Street Play in HackerLand

The Film and Theater Society of HackerLand is conducting a street play next month. The stage is n meters long, and there are m lights above it. Each light is either red, blue, or green. When all three colors shine on some area, that area appears to have white light.

Each light illuminates a range of the stage and is represented as three attributes:
color, left, right.

  • Color is 1, 2, or 3 to represent red, blue, and green.
  • Left and right represent the illuminated range’s extent.

Find the total number of integer positions on the stage illuminated with white light.

Example
The stage is n = 5 meters long and has m = 3 lights above it.

lights = [[1, 1, 5], [2, 2, 5], [3, 3, 5]]

  • Light 1 is red and covers a range from 1 to 5.
  • Light 2 is blue and covers a range from 2 to 5.
  • Light 3 is green and covers a range from 3 to 5.

The range [3, 5], locations 3, 4, and 5, receive white light. Return 3.

Function Description
Complete the function getWhiteLightLength in the editor below.


我们长期稳定承接各大科技公司如TikTok、Google、Amazon等的OA笔试代写服务,确保满分通过。如有需求,请随时联系我们。

We consistently provide professional online assessment services for major tech companies like TikTok, Google, and Amazon, guaranteeing perfect scores. Feel free to contact us if you're interested.

Leave a Reply

Your email address will not be published. Required fields are marked *