PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Art Advisors

Solve common array/graph interview problems

Last updated: Mar 29, 2026

Quick Overview

This multi-part question evaluates proficiency in array and matrix manipulation, graph traversal and shortest-path reasoning for word transformations, and algorithmic counting/selection for computing metrics like the H-index.

  • medium
  • Art Advisors
  • Coding & Algorithms
  • Software Engineer

Solve common array/graph interview problems

Company: Art Advisors

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given several independent coding tasks. Implement each function according to the specification below. ## 1) Rotate a square matrix in-place **Input:** An integer matrix `M` of size `n x n`. **Task:** Rotate the matrix **90 degrees clockwise** **in-place** (modify `M` directly). **Constraints:** - `1 <= n <= 500` - Aim for `O(n^2)` time and `O(1)` extra space. **Example:** - Input: ``` [[1,2,3], [4,5,6], [7,8,9]] ``` - Output: ``` [[7,4,1], [8,5,2], [9,6,3]] ``` --- ## 2) Shortest word transformation steps **Input:** - `begin`: a lowercase word - `end`: a lowercase word - `words`: a list of lowercase words (dictionary) **Task:** Return the length of the shortest sequence of transformations from `begin` to `end`, where: - Each step changes **exactly one character**. - Every intermediate word must exist in `words`. - If no sequence exists, return `0`. **Constraints:** - All words have the same length `L`. - `1 <= |words| <= 50_000`, `1 <= L <= 10`. **Example:** - `begin = "hit"`, `end = "cog"`, `words = ["hot","dot","dog","lot","log","cog"]` - Output: `5` (e.g., `hit -> hot -> dot -> dog -> cog`) --- ## 3) Compute the H-index A researcher’s H-index is defined as the maximum integer `h` such that the researcher has **at least `h` papers** with **at least `h` citations each**. **Input:** An array `citations` where `citations[i]` is the number of citations for paper `i`. **Task:** Return the researcher’s H-index. **Constraints:** - `0 <= n <= 200_000` - `0 <= citations[i] <= 1_000_000_000` - Prefer `O(n)` or `O(n log n)` time. **Example:** - Input: `[3,0,6,1,5]` - Output: `3` (three papers have at least 3 citations)

Quick Answer: This multi-part question evaluates proficiency in array and matrix manipulation, graph traversal and shortest-path reasoning for word transformations, and algorithmic counting/selection for computing metrics like the H-index.

Art Advisors logo
Art Advisors
Jan 12, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
0
0
Loading...

You are given several independent coding tasks. Implement each function according to the specification below.

1) Rotate a square matrix in-place

Input: An integer matrix M of size n x n.

Task: Rotate the matrix 90 degrees clockwise in-place (modify M directly).

Constraints:

  • 1 <= n <= 500
  • Aim for O(n^2) time and O(1) extra space.

Example:

  • Input:
    [[1,2,3],
     [4,5,6],
     [7,8,9]]
    
  • Output:
    [[7,4,1],
     [8,5,2],
     [9,6,3]]
    

2) Shortest word transformation steps

Input:

  • begin : a lowercase word
  • end : a lowercase word
  • words : a list of lowercase words (dictionary)

Task: Return the length of the shortest sequence of transformations from begin to end, where:

  • Each step changes exactly one character .
  • Every intermediate word must exist in words .
  • If no sequence exists, return 0 .

Constraints:

  • All words have the same length L .
  • 1 <= |words| <= 50_000 , 1 <= L <= 10 .

Example:

  • begin = "hit" , end = "cog" , words = ["hot","dot","dog","lot","log","cog"]
  • Output: 5 (e.g., hit -> hot -> dot -> dog -> cog )

3) Compute the H-index

A researcher’s H-index is defined as the maximum integer h such that the researcher has at least h papers with at least h citations each.

Input: An array citations where citations[i] is the number of citations for paper i.

Task: Return the researcher’s H-index.

Constraints:

  • 0 <= n <= 200_000
  • 0 <= citations[i] <= 1_000_000_000
  • Prefer O(n) or O(n log n) time.

Example:

  • Input: [3,0,6,1,5]
  • Output: 3 (three papers have at least 3 citations)

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Art Advisors•More Software Engineer•Art Advisors Software Engineer•Art Advisors Coding & Algorithms•Software 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.