FastPrepColor a Grid with No Monochromatic Row or Column
Problems/Color a Grid with No Monochromatic Row or Column

Color a Grid with No Monochromatic Row or Column

Intuit logoIntuit● MediumFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Intuit full-time online assessment. The linked task forbids whole rows and columns of a single color. It does not forbid equal adjacent cells. Our function keeps those rules. It is about 100% the same as the reported question.

Color every cell of a 3 by n grid with one of three labeled colors. No entire row and no entire column may consist of a single color. Adjacent cells may have equal colors as long as these whole-row and whole-column conditions hold. Return the number of colorings modulo 1000000007.

Function

countColorings(n: int) → int

Examples

Example 1

n = 1return = 0

Each length-one row would be monochromatic.

Example 2

n = 2return = 174

There are 174 colorings with all three rows using both positions differently and no monochromatic column.

Constraints

  • 1 <= n <= 20000. All three colors are available for every cell.

More Intuit Online Assessment questions

  • Employee Promotion OpportunitiesOA · Seen Oct 2026
  • Next Pascal Row CoefficientOA · Seen Oct 2026
  • Parse Router LogsOA · Seen Oct 2026
  • Longest Repeated Letter Block with Adjacent SwapsOA · Seen Oct 2026
  • Maximum Square-Free DivisorOA · Seen Oct 2026
  • Two Tribes from Taller-Person CountsOA · Seen Oct 2026
  • Shortest Path from an Encoded GraphOA · Seen Sep 2026
  • Oldest and Youngest EmployeesOA · Seen Sep 2026
  • Pressure-Isolation Shutdown OrderOA · Seen Sep 2026
  • Submask Sum QueriesOA · Seen Sep 2026

Similar questions at other companies

  • Frog Paths Without Long RunsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Get Triplet CountIBM · OAIBM interview questions
  • Sum of Pipeline Response TimesBloomberg LP · OABloomberg LP interview questions
  • Count Numbers with the Same Set-Bit CountMicrosoft · OAMicrosoft interview questions
  • Count Reverse-Digit PairsVisa · OAVisa interview questions
  • Get Triplet CountPoint72 · OAPoint72 interview questions
  • Count Shipment SchedulesMorgan Stanley · OAMorgan Stanley interview questions
  • Product of Subset MaximaArcesium · OAArcesium interview questions
  • Find Maximum Number of Balanced CombinationsAmazon · OA
  • Exactly K Preferred Role AssignmentsIMC Trading · OAIMC Trading interview questions

Intuit interview experiences

  • Intuit Software Engineering Intern - Full Stack OA Format
All Intuit interview questionsSee Intuit hiring insights
Saved
class Solution {
    public int countColorings(int n) {
        // Write your code here
    }
}
Checking account…