FastPrepIs This Date a Weekend?
Problems/Is This Date a Weekend?

Is This Date a Weekend?

Salesforce logoSalesforce● EasyFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Salesforce online assessment. The report asks whether a date is Saturday or Sunday. It does not say how the date is written, which calendar to use, which dates are valid, how locale is handled, or what exact type to return. Our version is about 85% the same as the reported question.

Given a valid calendar date date in exact YYYY-MM-DD form, return true if it falls on Saturday or Sunday. Return false if it falls on Monday through Friday.

Interpret the date with the proleptic Gregorian calendar. The result depends only on the calendar date, not on a time zone or locale.

Function

isWeekend(date: String) → boolean

Examples

Example 1

date = "2024-06-15"return = true

June 15, 2024 is a Saturday, so the result is true.

Example 2

date = "2024-06-17"return = false

June 17, 2024 is a Monday, so the result is false.

Example 3

date = "2000-01-02"return = true

January 2, 2000 is a Sunday, so the result is true.

Constraints

  • date has exactly ten characters in YYYY-MM-DD form.
  • The year is between 0001 and 9999, inclusive.
  • date is valid under the proleptic Gregorian calendar.

More Salesforce Online Assessment questions

  • Count Subarrays With Product Equal to KOA · Seen Nov 2026
  • Get Minimum TimeOA · Seen Nov 2026
  • Minimum No-Repeat Segments After One Character RemovalOA · Seen Nov 2026
  • Get Message StatusOA · Seen Nov 2026
  • Minimum Unique-Character Segments After DeletionOA · Seen Sep 2026
  • Run-Length String CompressionOA · Seen Sep 2026
  • Maximum Requests in WindowOA · Seen Sep 2026
  • Final Pod Counts After LogsOA · Seen Aug 2026
  • Minimum Removals to Balance ArrayOA · Seen Aug 2026
  • Maximum Barbell WeightOA · Seen Jul 2026

Similar questions at other companies

  • Polynomial CoefficientsShopify · OAShopify interview questions
  • Balance a Chemical EquationMicrosoft · OAMicrosoft interview questions
  • Simplify a Quadratic ExpressionOpenAI · OAOpenAI interview questions
  • Smallest Value for a Linear Expression ModuloIntel · OA
  • Transaction Fee Calculator — Parts 1–2: Basic Fee Calculation and Conditional Fee RulesStripe · PHONE SCREENStripe interview questions
  • Stack Formula InterpreterTypeSafe AI · PHONE SCREEN
  • Most Cost-Effective MachineCapital One · ONSITE INTERVIEWCapital One interview questions
  • Evaluate an Arithmetic Expression Written in WordsBrex · PHONE SCREEN
  • Calculate a Token-List ExpressionCollege Vine · ONSITE INTERVIEW
  • Parse, Normalize, and Combine PolynomialsSquarepoint Capital · PHONE SCREENSquarepoint Capital interview questions

Salesforce interview experiences

  • Salesforce Infrastructure SWE OA and Onsite: 1 Experience
  • Salesforce Experienced Backend SWE First Round: 1 Experience
All Salesforce interview questionsSee Salesforce hiring insights
Saved
class Solution {
    public boolean isWeekend(String date) {
        // write your code here
    }
}
Checking account…