PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Coding & Algorithms/TikTok

Implement distinct islands and sliding maxima

Last updated: Mar 29, 2026

Quick Overview

This question evaluates algorithm design and data-structure skills, specifically grid/graph traversal and shape-normalization for counting distinct island patterns and sliding-window maximum computation with linear-time data structures versus heap-based methods, categorized under Coding & Algorithms for a Software Engineer role.

  • Medium
  • TikTok
  • Coding & Algorithms
  • Software Engineer

Implement distinct islands and sliding maxima

Company: TikTok

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

1) Given a binary grid where 1 represents land and 0 represents water, count how many distinct island shapes exist. Two islands are considered the same if one can be translated (shifted) to match the other; rotations and reflections should be treated as different. Implement an algorithm that returns the count and analyze its time and space complexity. Then discuss how you would extend the method if rotations and reflections were also considered equivalent. 2) Given an integer array and a window size k, return the maximum value for every contiguous subarray of length k. Implement an O(n) solution and explain why it is linear. Compare this approach to a heap-based method and discuss trade-offs.

Quick Answer: This question evaluates algorithm design and data-structure skills, specifically grid/graph traversal and shape-normalization for counting distinct island patterns and sliding-window maximum computation with linear-time data structures versus heap-based methods, categorized under Coding & Algorithms for a Software Engineer role.

Related Interview Questions

  • Parse a nested list from a string - TikTok (medium)
  • Implement stacks, streaming median, and upward path sum - TikTok (easy)
  • Maximize sum with no adjacent elements - TikTok (medium)
  • Implement stack variants and path-sum check - TikTok (medium)
  • Find the longest palindromic substring - TikTok (easy)
TikTok logo
TikTok
Aug 8, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
1
0
  1. Given a binary grid where 1 represents land and 0 represents water, count how many distinct island shapes exist. Two islands are considered the same if one can be translated (shifted) to match the other; rotations and reflections should be treated as different. Implement an algorithm that returns the count and analyze its time and space complexity. Then discuss how you would extend the method if rotations and reflections were also considered equivalent.
  2. Given an integer array and a window size k, return the maximum value for every contiguous subarray of length k. Implement an O(n) solution and explain why it is linear. Compare this approach to a heap-based method and discuss trade-offs.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More TikTok•More Software Engineer•TikTok Software Engineer•TikTok Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ 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.