Autocoder

Tiger Analytics Coding Round Questions

Last updated 2026-11-19

For analytics roles, the technical screen is usually less about linked lists and more about whether you can query, reshape and reason about data. This page gives twelve practice problems in that spirit: SQL with window functions, pandas manipulations, a PySpark aggregation, plain Python on log data, one guesstimate and one case-logic problem, all with worked solutions and the mistakes that cost marks.

They are practice problems in the style of analytics screens, not copies of any test. Pair them with Tiger Analytics interview questions, how to crack the SQL interview and how to crack the data analyst interview.

Languages hereSQL, Python (pandas), PySpark
Also coveredOne guesstimate and one case-logic problem
LevelEasy to hard

How to approach these problems

For SQL, say the grain of the result first (one row per what?), then the join keys and the filters, and check for duplicates created by joins. For pandas, think in vectorised operations and avoid row loops. For guesstimates and cases, write down your structure before any numbers.

Hiring status

We hold no sourced facts about Tiger Analytics tests, drives, openings or cutoffs, so none are stated. Use the company's own careers site for current information.

Tiger Analytics Coding Round Questions: questions with worked answers

  1. 1

    SQL: the top two products by revenue in each category.

    easy

    Aggregate revenue per product, then DENSE_RANK within the category by revenue descending and keep ranks up to 2. DENSE_RANK keeps ties without skipping ranks; use ROW_NUMBER for exactly two rows. Window functions cannot be filtered in the same SELECT, so rank in a subquery. Mistake: using LIMIT 2, which returns two rows overall, not per category.

    sql
    SELECT category, product, revenue
    FROM (
      SELECT category, product, SUM(amount) AS revenue,
             DENSE_RANK() OVER (PARTITION BY category ORDER BY SUM(amount) DESC) AS rnk
      FROM sales
      GROUP BY category, product
    ) t
    WHERE rnk <= 2;
  2. 2

    SQL: the running total of daily sales, restarting each month.

    easy

    Use SUM as a window function with PARTITION BY month and ORDER BY date. With an ORDER BY the default frame is range-based from the partition start to the current row, which is what you want, but ties on the same date are treated together, so aggregate to one row per day first. Mistake: forgetting PARTITION BY and getting a running total across all months.

    sql
    SELECT sale_date,
           daily,
           SUM(daily) OVER (PARTITION BY DATE_TRUNC('month', sale_date)
                            ORDER BY sale_date) AS month_to_date
    FROM (SELECT sale_date, SUM(amount) AS daily FROM sales GROUP BY sale_date) d
    ORDER BY sale_date;
  3. 3

    SQL: users who were active on at least three consecutive days.

    medium

    The gaps-and-islands trick: take distinct active dates per user, number them with ROW_NUMBER, and subtract the row number (in days) from the date. Consecutive dates give the same result, so group by user and that value and keep groups of three or more. Mistake: not removing duplicate rows for the same day first, which breaks the numbering.

    sql
    SELECT DISTINCT user_id
    FROM (
      SELECT user_id, activity_date,
             activity_date - CAST(ROW_NUMBER() OVER (PARTITION BY user_id ORDER BY activity_date) AS INT) AS grp
      FROM (SELECT DISTINCT user_id, activity_date FROM activity) d
    ) t
    GROUP BY user_id, grp
    HAVING COUNT(*) >= 3;
  4. 4

    SQL: customers who bought in the last year but not in the last 90 days.

    medium

    Group by customer and compare the latest order date: customers whose maximum order date lies within the year but before the 90-day cutoff. This avoids a self-join. Mistake: filtering rows to the last year first and then testing for "no order in 90 days", which is contradictory; use HAVING on the aggregate.

    sql
    SELECT customer_id
    FROM orders
    GROUP BY customer_id
    HAVING MAX(order_date) >= CURRENT_DATE - INTERVAL '365 days'
       AND MAX(order_date) <  CURRENT_DATE - INTERVAL '90 days';
  5. 5

    pandas: total revenue and share of total per region, sorted by share.

    medium

    Group by region, sum revenue, then divide by the grand total in a vectorised step. Using reset_index gives a flat DataFrame. Mistake: computing the share with a Python loop, and dividing before aggregating so the denominator is wrong.

    python
    import pandas as pd
    
    df = pd.DataFrame({"region": ["N", "S", "N", "E"], "revenue": [100, 50, 60, 90]})
    out = df.groupby("region", as_index=False)["revenue"].sum()
    out["share"] = out["revenue"] / out["revenue"].sum()
    print(out.sort_values("share", ascending=False))
  6. 6

    pandas: keep the latest record for each customer.

    medium

    Sort by timestamp and drop duplicates on the customer key, keeping the last. Alternatively use groupby with idxmax. Complexity is dominated by the sort, O(n log n). Mistake: calling drop_duplicates without sorting first, which keeps whichever row happens to come first.

    python
    import pandas as pd
    
    df = pd.DataFrame({
        "cust": [1, 1, 2, 2],
        "updated": pd.to_datetime(["2026-01-01", "2026-03-01", "2026-02-01", "2026-01-15"]),
        "plan": ["a", "b", "c", "d"],
    })
    latest = df.sort_values("updated").drop_duplicates("cust", keep="last")
    print(latest)
  7. 7

    pandas: left join orders to customers, fill missing segments with "unknown" and count orders per segment.

    medium

    Merge with how="left" on the key so orders without a matching customer survive, fillna on the segment column, then groupby and size. Check for duplicate keys in the customers table first, since a duplicate multiplies order rows. Mistake: using an inner merge and silently dropping unmatched orders, and validating nothing; pass validate="many_to_one".

    python
    import pandas as pd
    
    orders = pd.DataFrame({"oid": [1, 2, 3], "cust": [10, 11, 99]})
    cust = pd.DataFrame({"cust": [10, 11], "segment": ["gold", "silver"]})
    m = orders.merge(cust, on="cust", how="left", validate="many_to_one")
    m["segment"] = m["segment"].fillna("unknown")
    print(m.groupby("segment").size())
  8. 8

    pandas: a 7-day rolling average of daily sales.

    medium

    Sort by date, set the date as the index and use rolling with a window of 7 observations, or "7D" for a time-based window that handles missing days correctly. The first six values are NaN unless min_periods is set. Mistake: using a count-based window on data with missing days, which then spans more than seven calendar days.

    python
    import pandas as pd
    
    s = pd.Series([10, 12, 9, 14, 11, 13, 15, 12],
                  index=pd.date_range("2026-01-01", periods=8))
    print(s.rolling("7D").mean())
  9. 9

    Python: from web-server log lines, count requests per status code and return the codes sorted by frequency.

    medium

    Split each line, pick the status field and count with Counter; most_common returns them sorted. O(n) to count. Mistake: parsing with fixed character positions that break when a path contains spaces; use a regular expression or the field position from the end.

    python
    from collections import Counter
    
    lines = [
        '10.0.0.1 GET /home 200',
        '10.0.0.2 GET /cart 500',
        '10.0.0.3 POST /pay 200',
    ]
    counts = Counter(line.split()[-1] for line in lines)
    print(counts.most_common())  # [('200', 2), ('500', 1)]
  10. 10

    PySpark: for a table of events, compute the number of distinct users and total spend per country, ordered by spend.

    medium

    Use groupBy with agg, countDistinct and sum, then orderBy descending. countDistinct is a wide operation that shuffles; for very large data approx_count_distinct trades exactness for speed. Mistake: collecting the data to the driver and aggregating in pandas, defeating the point of Spark.

    python
    from pyspark.sql import SparkSession, functions as F
    
    spark = SparkSession.builder.getOrCreate()
    df = spark.createDataFrame(
        [("IN", 1, 100.0), ("IN", 2, 50.0), ("US", 3, 80.0)],
        ["country", "user_id", "spend"])
    out = (df.groupBy("country")
             .agg(F.countDistinct("user_id").alias("users"), F.sum("spend").alias("total"))
             .orderBy(F.desc("total")))
    out.show()
  11. 11

    Guesstimate: estimate the number of food-delivery orders placed per day in a city of 10 million people.

    medium

    State assumptions, label them as such and keep arithmetic visible. Say 10 million people, about 60 percent are adults with smartphones: 6 million. Say 15 percent order delivery at least weekly: 0.9 million weekly users. If each orders about twice a week, that is 1.8 million orders per week, roughly 260,000 per day. Sanity-check against peak hours and cross-check bottom-up: if there are about 5,000 active restaurants and each takes about 50 delivery orders a day, that is 250,000, which agrees. Say which assumptions you would validate first.

  12. 12

    Case logic: a subscription app's monthly revenue is flat, but the number of new subscribers is up 20 percent. What could explain it?

    hard

    Revenue is roughly active subscribers times average revenue per user, so rising sign-ups with flat revenue means churn offsets gains or revenue per user fell. Hypotheses: higher churn among new cohorts (check cohort retention curves), a discounted or trial-heavy acquisition mix lowering ARPU, a downgrade to cheaper plans, or a billing or currency effect. Data to check: cohort retention, plan mix, discount share and refund rate. The next step depends on which breaks down: fix onboarding if early churn dominates, or revisit promotions if the mix shifted.

  13. 13

    Python: given daily revenue, find the longest stretch of days where revenue strictly increases each day.

    hard

    Scan once keeping the current streak length and the best seen; extend when today exceeds yesterday and reset to one otherwise. O(n) time, O(1) space. Mistake: comparing with the start of the streak rather than the previous day, and returning the index rather than the length when the statement asks for length.

    python
    def longest_increasing_run(a):
        if not a:
            return 0
        best = cur = 1
        for i in range(1, len(a)):
            cur = cur + 1 if a[i] > a[i - 1] else 1
            best = max(best, cur)
        return best
    
    print(longest_increasing_run([3, 4, 5, 2, 3, 4, 5, 6]))  # 5

Frequently asked questions

What should I practise for an analytics coding round?

SQL joins, aggregation and window functions, pandas groupby, merge and rolling operations, basic Python data handling, and a few guesstimates and cases.

Which SQL dialect should I use?

Use the dialect the platform offers, usually PostgreSQL, MySQL or SQL Server. Date functions differ, so know how to do date truncation and differences in your dialect.

Are pandas questions common?

For data science roles, pandas manipulation is a sensible area to prepare. Know groupby, merge, pivot_table, sort_values, drop_duplicates and rolling.

Are these real Tiger Analytics questions?

No, they are practice problems in the style of analytics screens, not copies of any test.

How do I answer guesstimates well?

Define the scope, break the quantity into a multiplication of estimable parts, state each assumption and sanity-check with a second approach.

Related guides

More in Company Interview Questions

See all in this section