PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Coding & Algorithms/Other

Check if a numeric string is divisible by 8

Last updated: Mar 29, 2026

Quick Overview

This question evaluates understanding of elementary number theory (divisibility rules) and algorithmic string processing for representing and reasoning about very large integers.

  • easy
  • Other
  • Coding & Algorithms
  • Data Scientist

Check if a numeric string is divisible by 8

Company: Other

Role: Data Scientist

Category: Coding & Algorithms

Difficulty: easy

Interview Round: Technical Screen

## Problem You are given a **very large** non-negative integer represented as a string `s` (it may be too large to fit in standard integer types). Write a function that returns `True` if the number represented by `s` is divisible by **8**, otherwise return `False`. ### Constraints / Requirements - Do **not** convert the entire string to an integer type (e.g., no `int(s)`). - `s` consists only of digits `'0'`–`'9'`. - Leading zeros may exist (e.g., `"00016"`). ## Examples - `s = "16"` → `True` - `s = "123"` → `False` - `s = "1000"` → `True`

Quick Answer: This question evaluates understanding of elementary number theory (divisibility rules) and algorithmic string processing for representing and reasoning about very large integers.

Related Interview Questions

  • Implement a multi-button click detector - Other (hard)
  • Compute total after discounting most expensive item - Other (medium)
  • Return the k-th row of Pascal-like triangle - Other (medium)
  • Implement multiplication without using the multiplication operator - Other (Medium)
  • Prove reservoir sampling correctness - Other (Medium)
Other logo
Other
Sep 28, 2025, 12:00 AM
Data Scientist
Technical Screen
Coding & Algorithms
2
0

Problem

You are given a very large non-negative integer represented as a string s (it may be too large to fit in standard integer types).

Write a function that returns True if the number represented by s is divisible by 8, otherwise return False.

Constraints / Requirements

  • Do not convert the entire string to an integer type (e.g., no int(s) ).
  • s consists only of digits '0' – '9' .
  • Leading zeros may exist (e.g., "00016" ).

Examples

  • s = "16" → True
  • s = "123" → False
  • s = "1000" → True

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Other•More Data Scientist•Other Data Scientist•Other Coding & Algorithms•Data Scientist 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.