InterviewLegend

Calculators and Parsing

Alex Chen50 min readUpdated 49 real interview reports

Calculator problems come up often at Splunk. A hiring manager has opened a phone screen with one, a staff round has started with one, and an online assessment has added a twist to the string. It fits the product, since SPL's eval command does arithmetic over event fields.

The way to handle all of them is to build one loop and keep it. Read numbers a digit at a time and skip spaces. Keep a running total plus one open term. Times and divide fold into the term right away, plus or minus closes it out, and division truncates toward zero.

Each later version changes one rule, and a good loop absorbs it with a small change. Writing a fresh parser for each version takes time the round doesn't give you.

SplunkPremium lesson · Coding round

The 4 Splunk problems are below.

  1. A Premium questionCoding · Medium · Signature problem
  2. A Premium questionCoding · Hard · Signature problem
  3. A Premium questionCoding · Medium

+ 1 more in this lesson

Each with hints, the follow-up and a tested solution.

Get the Splunk questions

$49 a year · all 100 companies · cancel anytime

From 20,000+ candidate reports, forum threads behind logins and write-ups in Chinese.

Had your Splunk interview?Tell us what they asked. Reviewed before it goes in, never with your name.
Splunk interview guide

Know what Splunk asks before you walk in.

30 coding · 1 system design · 15 behavioral questions

Get Premium$49 a year · Cancel anytime
Or start freeNo card.

Get their questions first.

InterviewLegend is independent and not affiliated with or endorsed by any company it covers.