# Climbing Stairs coding question | Aced

Aced (formerly Exponent) publishes a public search API over its indexed pages; the guide is at https://www.aced.io/agents/agent-access.

Source: https://www.aced.io/questions/3255/climbing-stairs
Source observed: 2026-11-04T22:21:37.521Z
Last checked: 2026-11-04T22:21:37.521+00:00
Indexed: 2026-11-06T17:58:48.693+00:00

---

# Climbing Stairs

We provide interview-preparation questions, interview experiences, coding practice, and courses at Aced (formerly Exponent). This page contains an **Easy** data-structures-and-algorithms coding question.

## Problem

Given an integer `n`, representing the number of steps in a staircase, write a function `climbStairs` that returns the number of distinct ways to climb to the top. Each move may climb either 1 step or 2 steps. `n` is a non-negative integer.

## Examples

- `n = 1` → `1` way: climb 1 step.
- `n = 2` → `2` ways: climb 1 + 1 steps, or climb 2 steps directly.
- `n = 3` → `3` ways: climb 1 + 1 + 1, 1 + 2, or 2 + 1.
- `n = 4` → `5` ways: climb 1 + 1 + 1 + 1, 1 + 1 + 2, 1 + 2 + 1, 2 + 1 + 1, or 2 + 2.

The question includes Question, Solution, and Community views. Detailed company statistics are available through [Upgrade](https://www.aced.io/upgrade?src=questions). A code editor includes output, test-results, and console panels; running code requires [signing up](https://www.aced.io/signup?src=lesson). The community section has 26 items in the rendered interface, while the source text says that no community answers have been contributed yet.

## Question metadata

- Category: [Data Structures & Algorithms](https://www.aced.io/questions?type=algorithms&filterBy=codeEditor&src=nav)
- Also categorized as [Coding Questions](https://www.aced.io/questions?type=algorithms&filterBy=codeEditor&src=nav)
- Roles associated with the question: [Software Engineer](https://www.aced.io/questions?role=swe), [Data Scientist](https://www.aced.io/questions?role=data-science), and [Data Engineer](https://www.aced.io/questions?role=data-engineer)
- Associated companies listed: [Google](https://www.aced.io/questions?company=google), [Pinterest](https://www.aced.io/questions?company=pinterest), [Amazon](https://www.aced.io/questions?company=amazon), [Fresh Prep](https://www.aced.io/questions?company=fresh-prep), [Salesforce](https://www.aced.io/questions?company=salesforce), [Walmart Labs](https://www.aced.io/questions?company=walmart-labs), and [Adobe](https://www.aced.io/questions?company=adobe). The rendered interface also lists Goldman Sachs.
- Rendered metadata: 47 saves, 7 Software Engineer associations, 2 Google associations, and “Reported last asked: 5 months ago.”

## Interview experiences

Six shared interview experiences are linked below. The dates are relative labels retained exactly as displayed.

1. [Google · 5 months ago](https://www.aced.io/experiences/google-senior-software-engineer-interview-41b522) — Software Engineer, Senior / L5. “It's pretty standard. Medium difficulty, nothing that is really surprising. For the domain interview, they also expect you to do a mini-design, but it was simple and brief.”
2. [Pinterest · 5 months ago](https://www.aced.io/experiences/pinterest-senior-software-engineer-interview-d68c8c) — Software Engineer, Senior / L5. “Process was good. wish it was a bit quicker though it lasted a long time. try to get through final round as quick as possible since it takes a while afterwards to hear back”
3. [Amazon · 6 months ago](https://www.aced.io/experiences/amazon-software-engineer-interview-771fec) — Software Engineer. “The tech interviewer requested a more technical answer. So i expanded on my existing experience. Complex systems are good to explain.”
4. [Fresh Prep · a year ago](https://www.aced.io/experiences/fresh-prep-software-engineer-interview-9d2dd8) — Software Engineer, Entry Level / L3. The contributor describes a Full Stack Developer process with a take-home assessment followed by a final interview. The take-home assessed practical development, coding approach, problem-solving, and independent solution structure. The final round covered computer-science fundamentals, technical problem-solving, prior development experience, data structures and algorithms, object-oriented programming, databases, APIs, software-engineering concepts, projects, and technical decisions. The contributor describes the process as structured, balanced between practical coding and theory, and professional.
5. [Salesforce · a year ago](https://www.aced.io/experiences/salesforce-staff-software-engineer-interview-3e07e8) — Software Engineer, Staff / L6. “Went well, The interviewer has experience and the questions asked was more systematic aligned to the job posting and tweaked as per the resume submitted”
6. [Walmart Labs · a year ago](https://www.aced.io/experiences/walmart-labs-software-engineer-interview-751680) — Software Engineer, Mid Level / L4. “The interview process was well-structured and fairly rigorous compared to others I’ve experienced. I appreciated that the recruiter clearly communicated expectations upfront, which helped me prepare in the right direction. The technical rounds were challenging but relevant to the role, and the interviewers were professional and engaging.”

## Related courses

### [Data Science Interview Prep](https://www.aced.io/courses/data-science)

![Data Science Interview Prep](https://images.ctfassets.net/x78yjrjc11pq/3U4C5C0OkDR0UeGch4AmlE/7ad489430b676a088cb973307fe77884/Data_Science_Interview_Prep_Course.jpeg?w=800&h=800&fm=webp&q=75)

We cover mock interviews, frameworks, and advice from senior candidates for data-science roles at Google, Amazon, Microsoft, Meta, Apple, and other top companies. Topics include statistics, experimentation, coding, SQL, machine learning, behavioral interviews, and more.

### [Data Engineering Interview Prep](https://www.aced.io/courses/data-engineering)

![Data Engineering Interview Prep](https://images.ctfassets.net/x78yjrjc11pq/5XoOCgXlGqN2fa1zaroNWd/9a2e23df48a212bc00d352873feb2d6a/Data_Engineer_Interview_Prep_Hero_Image.jpg?w=800&h=800&fm=webp&q=75)

We cover mock interviews, frameworks, and advice from senior candidates for data-engineering roles at Meta, Google, Amazon, Microsoft, Walmart, DoorDash, and other top companies. Topics include data modeling, pipeline design, SQL, coding, and behavioral interviews.

## Aced interview-preparation areas

We offer courses and practice for Product Management, Forward Deployed Engineering, Engineering Management, Software Engineering, System Design, Data Science, Machine Learning, Data Engineering, AI Engineering, Investment Banking, Generative AI, Security Engineer, TPM, Solutions Architect, UX / Product Design, and BizOps & Strategy. We also offer interview experiences, practice, coaching, resume review, salary negotiation, job referrals, resources, and business, university, recruiter, and affiliate programs.

[All Questions](https://www.aced.io/questions) · [Courses](https://www.aced.io/courses?src=nav) · [Experiences](https://www.aced.io/experiences?src=nav) · [Practice](https://www.aced.io/practice?src=nav) · [Coaching](https://www.aced.io/coaching?src=nav) · [Log in](https://www.aced.io/login?src=nav) · [Sign up](https://www.aced.io/signup?src=nav)

---

[Read this page’s summary](https://www.aced.io/agents/api/public/v1/page-tldr?url=https%3A%2F%2Fwww.aced.io%2Fquestions%2F3255%2Fclimbing-stairs&trace=t_679ff9ab98f3)

## Ask a follow-up about this page

Need a more specific answer? Ask the exact question you have. It returns a fresh, cited answer from Aced (formerly Exponent)’s knowledge base. No account or API key required.

Open this URL with your own question, URL-encoded. Include your question in q. All research inputs are optional; no account or setup.

`GET https://www.aced.io/agents/agent/faq?q={question}&trace=t_679ff9ab98f3`

[Tool guide and examples](https://www.aced.io/agents/agent-access) · [OpenAPI](https://www.aced.io/agents/api/public/v1/openapi.json) · [Page TLDR form](https://www.aced.io/agents/agent-tools/page-tldr?url=https%3A%2F%2Fwww.aced.io%2Fquestions%2F3255%2Fclimbing-stairs). Opening a form does not execute a tool.