FastPrepEvaluate a Blackjack Hand
Problems/Evaluate a Blackjack Hand

Evaluate a Blackjack Hand

Goldman Sachs logoGoldman Sachs● EasyFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A Goldman Sachs superday report asks whether a blackjack hand reaches 21 when each Ace may count as 1 or 11. It does not say how cards are written, what face cards are worth, or whether hands may have more than two cards. Our version works on a finite hand and is about 88% the same as the reported question.

Given a blackjack hand in cards, return whether the cards can total exactly 21.

  • Cards 2 through 10 use their numeric values.
  • J, Q, and K each count as 10.
  • Each A may independently count as 1 or 11.

The hand may contain any positive number of cards.

Function

isBlackjack(cards: String[]) → boolean

Examples

Example 1

cards = ["A","K"]return = true

The Ace counts as 11, giving 21.

Example 2

cards = ["K","Q"]return = false

The total is 20.

Constraints

  • 1 <= cards.length <= 52
  • Every card is one of A, 2 through 10, J, Q, or K.

More Goldman Sachs Onsite Interview questions

  • Knight Probability in ChessboardONSITE INTERVIEW · Seen Nov 2026
  • Best Average Student ScorePHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Meeting RoomsPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Minimum Meeting Rooms Without a Sweep LineONSITE INTERVIEW · Seen Oct 2026
  • First Non-Repeating CharacterPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Root of the Largest TreePHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Dungeon HealthONSITE INTERVIEW · Seen Sep 2026
  • Insert, Delete, And Get Random In Constant TimeONSITE INTERVIEW · Seen Sep 2026
  • Least Recently Used CacheONSITE INTERVIEW · Seen Sep 2026
  • Staircase Search In A Sorted MatrixONSITE INTERVIEW · Seen Sep 2026

Similar questions at other companies

  • Latest Arrival Time for a ShuttleGoogle · ONSITE INTERVIEWGoogle interview questions
  • Assign Partitions to the Least-Loaded ServersAmazon · ONSITE INTERVIEW
  • Team-Preferred Stable MatchingBloomberg LP · ONSITE INTERVIEWBloomberg LP interview questions
  • Total Stops of an Elevator Serving a QueueExpedia · ONSITE INTERVIEWExpedia interview questions
  • Catch Fish with Reusable BaitsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Climb Detection with Recoverable DipsStrava · PHONE SCREEN
  • Final Pod Counts After LogsSalesforce · OASalesforce interview questions
  • Text JustificationUber · PHONE SCREENUber interview questions
  • Experiment Bucket Allocation and RebalancingPinterest · PHONE SCREENPinterest interview questions
  • Find GPU Capacity and Drain a NodeTogether AI · PHONE SCREEN
All Goldman Sachs interview questionsSee Goldman Sachs hiring insights
Saved
class Solution {
    public boolean isBlackjack(String[] cards) {
      // write your code here
    }
}
Checking account…