Repository: yangshun/tech-interview-handbook Branch: main Commit: 37d533e4de82 Files: 505 Total size: 5.5 MB Directory structure: gitextract__wrmwl_2/ ├── .editorconfig ├── .github/ │ ├── FUNDING.yml │ └── workflows/ │ ├── lint.yml │ └── tsc.yml ├── .gitignore ├── .vite-hooks/ │ └── pre-commit ├── .vscode/ │ ├── extensions.json │ └── settings.json ├── AGENTS.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── algorithms/ │ └── README.md ├── apps/ │ ├── portal/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── next-env.d.ts │ │ ├── next.config.mjs │ │ ├── package.json │ │ ├── postcss.config.cjs │ │ ├── prisma/ │ │ │ ├── companies.csv │ │ │ ├── data/ │ │ │ │ ├── cities.json │ │ │ │ ├── countries.json │ │ │ │ └── states.json │ │ │ ├── migrations/ │ │ │ │ ├── 20220928103800_init/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221002033341_add_todos/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221006024246_add_companies/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221006090216_add_resume_schemas/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221007062555_add_resume_profile_model/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221007110225_add_questions_model/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221007135344_remove_resumes_profile_model/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221008090846_add_question_types/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221008114522_add_questions_company_loaction_role/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221008165306_update_vote_enum/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221009093357_update_question_encounter_schema/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221009160601_/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221010055218_update_question_encounter_to_use_company_id/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221011042156_/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221012161857_add_user_to_replies/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221013032033_update_resume_vote_to_enum/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221014192315_/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221014205230_/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221014211740_/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221019104025_update_offers_remove_optional/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221020101123_add_resume_comment_parent/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221020115540_/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221021150358_add_vote_count_and_last_seen/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221021151424_delete_extra_encounter_fields/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221021155717_add_sorting_index/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221021231817_/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221021233952_change_currency_values_to_float/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221023100925_update_last_seen_val_to_be_optional/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221023102619_add_list_schema/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221023203239_/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221024123252_add_upvotes_to_schema/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221024123849_add_upvotes_default_value/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221024154046_remove_specialization_and_make_base_bonus_and_stocks_optional/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221027052436_resumes_add_is_resolved_status/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221029180052_add_ecnounter_sort_support/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221030024321_locations/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221030121147_use_roles_and_location_table/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221030133638_add_theory_enum/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221031033529_change_analysis_models_to_allow_for_multiple_company_analysis/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221102121331_update_location_for_offers/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221103031927_change_company_in_analysis_unit/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221104042559_add_reference_to_analysed_offer_in_analysis_unit/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221104084342_add_cascade_delete_to_analysed_offer_in_analysis_unit/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221104084451_add_cascade_delete_to_overall_analysis_in_offers_analysis/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221104095551_use_location_database_for_resumes/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221105140124_revert_default_location/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221106002645_country_ranking/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221107014555_company_website/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221108061935_add_comment_deletion/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221109070931_company_city_ranking/ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20221117094655_add_offersadmin_table/ │ │ │ │ │ └── migration.sql │ │ │ │ └── migration_lock.toml │ │ │ ├── salaries.xlsx │ │ │ ├── schema.prisma │ │ │ ├── seed-analysis.ts │ │ │ ├── seed-companies.ts │ │ │ ├── seed-questions.ts │ │ │ ├── seed-salaries.ts │ │ │ └── seed.ts │ │ ├── src/ │ │ │ ├── components/ │ │ │ │ ├── global/ │ │ │ │ │ ├── AppShell.tsx │ │ │ │ │ ├── GlobalNavigation.ts │ │ │ │ │ ├── GoogleAnalytics.tsx │ │ │ │ │ ├── HomeNavigation.ts │ │ │ │ │ ├── MobileNavigation.tsx │ │ │ │ │ └── ProductNavigation.tsx │ │ │ │ ├── offers/ │ │ │ │ │ ├── Breadcrumbs.tsx │ │ │ │ │ ├── EducationFields.ts │ │ │ │ │ ├── EducationLevels.ts │ │ │ │ │ ├── InternshipCycles.ts │ │ │ │ │ ├── JobTypeTabs.tsx │ │ │ │ │ ├── OffersNavigation.tsx │ │ │ │ │ ├── Years.ts │ │ │ │ │ ├── admin/ │ │ │ │ │ │ ├── OffersHeader.tsx │ │ │ │ │ │ ├── OffersRow.tsx │ │ │ │ │ │ ├── OffersTable.tsx │ │ │ │ │ │ ├── OffersTablePagination.tsx │ │ │ │ │ │ └── types.ts │ │ │ │ │ ├── constants.ts │ │ │ │ │ ├── dashboard/ │ │ │ │ │ │ ├── DashboardOfferCard.tsx │ │ │ │ │ │ └── DashboardProfileCard.tsx │ │ │ │ │ ├── features/ │ │ │ │ │ │ ├── LeftTextCard.tsx │ │ │ │ │ │ └── RightTextCard.tsx │ │ │ │ │ ├── forms/ │ │ │ │ │ │ ├── FormCitiesTypeahead.tsx │ │ │ │ │ │ ├── FormCompaniesTypeahead.tsx │ │ │ │ │ │ ├── FormJobTitlesTypeahead.tsx │ │ │ │ │ │ ├── FormMonthYearPicker.tsx │ │ │ │ │ │ ├── FormRadioList.tsx │ │ │ │ │ │ ├── FormSection.tsx │ │ │ │ │ │ ├── FormSelect.tsx │ │ │ │ │ │ ├── FormTextArea.tsx │ │ │ │ │ │ └── FormTextInput.tsx │ │ │ │ │ ├── offerAnalysis/ │ │ │ │ │ │ ├── OfferAnalysis.tsx │ │ │ │ │ │ ├── OfferPercentileAnalysisText.tsx │ │ │ │ │ │ └── OfferProfileCard.tsx │ │ │ │ │ ├── offersSubmission/ │ │ │ │ │ │ ├── OffersProfileSave.tsx │ │ │ │ │ │ ├── OffersSubmissionAnalysis.tsx │ │ │ │ │ │ ├── OffersSubmissionForm.tsx │ │ │ │ │ │ └── submissionForm/ │ │ │ │ │ │ ├── BackgroundForm.tsx │ │ │ │ │ │ └── OfferDetailsForm.tsx │ │ │ │ │ ├── profile/ │ │ │ │ │ │ ├── EducationCard.tsx │ │ │ │ │ │ ├── OfferCard.tsx │ │ │ │ │ │ ├── ProfileComments.tsx │ │ │ │ │ │ ├── ProfileDetails.tsx │ │ │ │ │ │ ├── ProfileHeader.tsx │ │ │ │ │ │ ├── ProfilePhotoHolder.tsx │ │ │ │ │ │ └── comments/ │ │ │ │ │ │ ├── CommentCard.tsx │ │ │ │ │ │ └── ExpandableCommentCard.tsx │ │ │ │ │ ├── table/ │ │ │ │ │ │ ├── OffersHeader.tsx │ │ │ │ │ │ ├── OffersRow.tsx │ │ │ │ │ │ ├── OffersTable.tsx │ │ │ │ │ │ ├── OffersTablePagination.tsx │ │ │ │ │ │ └── types.ts │ │ │ │ │ ├── types.ts │ │ │ │ │ └── util/ │ │ │ │ │ └── Tooltip.tsx │ │ │ │ ├── questions/ │ │ │ │ │ ├── AddToListDropdown.tsx │ │ │ │ │ ├── ContributeQuestionCard.tsx │ │ │ │ │ ├── ContributeQuestionDialog.tsx │ │ │ │ │ ├── CreateListDialog.tsx │ │ │ │ │ ├── DeleteListDialog.tsx │ │ │ │ │ ├── DiscardDraftDialog.tsx │ │ │ │ │ ├── FullScreenSpinner.tsx │ │ │ │ │ ├── LandingComponent.tsx │ │ │ │ │ ├── PaginationLoadMoreButton.tsx │ │ │ │ │ ├── QuestionAggregateBadge.tsx │ │ │ │ │ ├── QuestionContainer.tsx │ │ │ │ │ ├── QuestionSearchBar.tsx │ │ │ │ │ ├── QuestionTypeBadge.tsx │ │ │ │ │ ├── QuestionsNavigation.tsx │ │ │ │ │ ├── SortOptionsSelect.tsx │ │ │ │ │ ├── VotingButtons.tsx │ │ │ │ │ ├── card/ │ │ │ │ │ │ ├── AnswerCard.tsx │ │ │ │ │ │ ├── FullAnswerCard.tsx │ │ │ │ │ │ ├── QuestionAnswerCard.tsx │ │ │ │ │ │ └── question/ │ │ │ │ │ │ ├── BaseQuestionCard.tsx │ │ │ │ │ │ ├── FullQuestionCard.tsx │ │ │ │ │ │ ├── QuestionListCard.tsx │ │ │ │ │ │ ├── QuestionOverviewCard.tsx │ │ │ │ │ │ └── SimilarQuestionCard.tsx │ │ │ │ │ ├── comments/ │ │ │ │ │ │ ├── AnswerCommentListItem.tsx │ │ │ │ │ │ ├── CommentListItem.tsx │ │ │ │ │ │ └── QuestionCommentListItem.tsx │ │ │ │ │ ├── filter/ │ │ │ │ │ │ └── FilterSection.tsx │ │ │ │ │ ├── forms/ │ │ │ │ │ │ ├── ContributeQuestionForm.tsx │ │ │ │ │ │ └── CreateQuestionEncounterForm.tsx │ │ │ │ │ ├── layout/ │ │ │ │ │ │ └── BackButtonLayout.tsx │ │ │ │ │ ├── protected/ │ │ │ │ │ │ ├── ProtectedContextProvider.tsx │ │ │ │ │ │ └── ProtectedDialog.tsx │ │ │ │ │ └── typeahead/ │ │ │ │ │ ├── CompanyTypeahead.tsx │ │ │ │ │ ├── ExpandedTypeahead.tsx │ │ │ │ │ ├── LocationTypeahead.tsx │ │ │ │ │ └── RoleTypeahead.tsx │ │ │ │ ├── resumes/ │ │ │ │ │ ├── ResumePdf.tsx │ │ │ │ │ ├── ResumesNavigation.tsx │ │ │ │ │ ├── badgeIcons/ │ │ │ │ │ │ ├── popularResumes/ │ │ │ │ │ │ │ ├── ResumeBadgeCoolIcon.tsx │ │ │ │ │ │ │ ├── ResumeBadgeRocketIcon.tsx │ │ │ │ │ │ │ └── ResumeBadgeTreasureIcon.tsx │ │ │ │ │ │ ├── resume-badge.d.ts │ │ │ │ │ │ ├── reviewer/ │ │ │ │ │ │ │ ├── ResumeBadgeDetectiveIcon.tsx │ │ │ │ │ │ │ ├── ResumeBadgeEagleIcon.tsx │ │ │ │ │ │ │ └── ResumeBadgeSuperheroIcon.tsx │ │ │ │ │ │ └── topComment/ │ │ │ │ │ │ ├── ResumeBadgeBookIcon.tsx │ │ │ │ │ │ ├── ResumeBadgeOwlIcon.tsx │ │ │ │ │ │ └── ResumeBadgeSageIcon.tsx │ │ │ │ │ ├── badges/ │ │ │ │ │ │ ├── ResumeUserBadge.tsx │ │ │ │ │ │ ├── ResumeUserBadges.tsx │ │ │ │ │ │ └── resumeBadgeConstants.ts │ │ │ │ │ ├── browse/ │ │ │ │ │ │ ├── ResumeFilterPill.tsx │ │ │ │ │ │ ├── ResumeListItem.tsx │ │ │ │ │ │ └── ResumeListItems.tsx │ │ │ │ │ ├── comments/ │ │ │ │ │ │ ├── ResumeCommentListItem.tsx │ │ │ │ │ │ ├── ResumeCommentsForm.tsx │ │ │ │ │ │ ├── ResumeCommentsList.tsx │ │ │ │ │ │ ├── comment/ │ │ │ │ │ │ │ ├── ResumeCommentDeleteForm.tsx │ │ │ │ │ │ │ ├── ResumeCommentEditForm.tsx │ │ │ │ │ │ │ ├── ResumeCommentReplyForm.tsx │ │ │ │ │ │ │ └── ResumeCommentVoteButtons.tsx │ │ │ │ │ │ └── resumeCommentConstants.ts │ │ │ │ │ ├── landing/ │ │ │ │ │ │ ├── CallToAction.tsx │ │ │ │ │ │ ├── Container.tsx │ │ │ │ │ │ ├── Hero.tsx │ │ │ │ │ │ ├── Logo.tsx │ │ │ │ │ │ └── PrimaryFeatures.tsx │ │ │ │ │ ├── shared/ │ │ │ │ │ │ ├── ResumeExpandableText.tsx │ │ │ │ │ │ ├── ResumeExperienceTypeahead.tsx │ │ │ │ │ │ └── ResumeSignInButton.tsx │ │ │ │ │ └── submit-form/ │ │ │ │ │ └── ResumeSubmissionGuidelines.tsx │ │ │ │ └── shared/ │ │ │ │ ├── CitiesTypeahead.tsx │ │ │ │ ├── CompaniesTypeahead.tsx │ │ │ │ ├── CompanyProfileImage.tsx │ │ │ │ ├── Container.tsx │ │ │ │ ├── CountriesTypeahead.tsx │ │ │ │ ├── JobTitles.ts │ │ │ │ ├── JobTitlesTypeahead.tsx │ │ │ │ ├── MonthYearPicker.tsx │ │ │ │ ├── icons/ │ │ │ │ │ └── GitHubIcon.tsx │ │ │ │ └── loginPageHref.ts │ │ │ ├── constants/ │ │ │ │ └── file-storage-keys.ts │ │ │ ├── env/ │ │ │ │ ├── client.mjs │ │ │ │ ├── schema.mjs │ │ │ │ └── server.mjs │ │ │ ├── mappers/ │ │ │ │ └── offers-mappers.ts │ │ │ ├── middleware.ts │ │ │ ├── pages/ │ │ │ │ ├── 404.tsx │ │ │ │ ├── _app.tsx │ │ │ │ ├── _document.tsx │ │ │ │ ├── api/ │ │ │ │ │ ├── auth/ │ │ │ │ │ │ └── [...nextauth].ts │ │ │ │ │ ├── file-storage.ts │ │ │ │ │ ├── restricted.ts │ │ │ │ │ └── trpc/ │ │ │ │ │ └── [trpc].ts │ │ │ │ ├── index.tsx │ │ │ │ ├── login.tsx │ │ │ │ ├── offers/ │ │ │ │ │ ├── about.tsx │ │ │ │ │ ├── admin.tsx │ │ │ │ │ ├── dashboard.tsx │ │ │ │ │ ├── features.tsx │ │ │ │ │ ├── index.tsx │ │ │ │ │ ├── profile/ │ │ │ │ │ │ ├── [offerProfileId].tsx │ │ │ │ │ │ └── edit/ │ │ │ │ │ │ └── [offerProfileId].tsx │ │ │ │ │ └── submit/ │ │ │ │ │ ├── index.tsx │ │ │ │ │ └── result/ │ │ │ │ │ └── [offerProfileId].tsx │ │ │ │ ├── profile.tsx │ │ │ │ ├── questions/ │ │ │ │ │ ├── [questionId]/ │ │ │ │ │ │ └── [questionSlug]/ │ │ │ │ │ │ ├── answer/ │ │ │ │ │ │ │ └── [answerId]/ │ │ │ │ │ │ │ └── [answerSlug]/ │ │ │ │ │ │ │ └── index.tsx │ │ │ │ │ │ └── index.tsx │ │ │ │ │ ├── about.tsx │ │ │ │ │ ├── browse.tsx │ │ │ │ │ ├── history.tsx │ │ │ │ │ ├── index.tsx │ │ │ │ │ ├── lists.tsx │ │ │ │ │ └── my-questions.tsx │ │ │ │ ├── resumes/ │ │ │ │ │ ├── [resumeId].tsx │ │ │ │ │ ├── about.tsx │ │ │ │ │ ├── features.tsx │ │ │ │ │ ├── index.tsx │ │ │ │ │ └── submit.tsx │ │ │ │ ├── settings.tsx │ │ │ │ ├── test__.tsx │ │ │ │ └── todos/ │ │ │ │ ├── index.tsx │ │ │ │ └── new.tsx │ │ │ ├── server/ │ │ │ │ ├── common/ │ │ │ │ │ └── get-server-auth-session.ts │ │ │ │ ├── db/ │ │ │ │ │ └── client.ts │ │ │ │ └── router/ │ │ │ │ ├── companies-router.ts │ │ │ │ ├── context.ts │ │ │ │ ├── index.ts │ │ │ │ ├── locations-router.ts │ │ │ │ ├── offers/ │ │ │ │ │ ├── offers-admin-router.ts │ │ │ │ │ ├── offers-analysis-router.ts │ │ │ │ │ ├── offers-comments-router.ts │ │ │ │ │ ├── offers-profile-router.ts │ │ │ │ │ ├── offers-user-profile-router.ts │ │ │ │ │ └── offers.ts │ │ │ │ ├── protected-example-router.ts │ │ │ │ ├── questions/ │ │ │ │ │ ├── questions-answer-comment-router.ts │ │ │ │ │ ├── questions-answer-comment-user-router.ts │ │ │ │ │ ├── questions-answer-router.ts │ │ │ │ │ ├── questions-answer-user-router.ts │ │ │ │ │ ├── questions-list-router.ts │ │ │ │ │ ├── questions-question-comment-router.ts │ │ │ │ │ ├── questions-question-comment-user-router.ts │ │ │ │ │ ├── questions-question-encounter-router.ts │ │ │ │ │ ├── questions-question-encounter-user-router.ts │ │ │ │ │ ├── questions-question-router.ts │ │ │ │ │ └── questions-question-user-router.ts │ │ │ │ ├── resumes/ │ │ │ │ │ ├── resumes-comments-router.ts │ │ │ │ │ ├── resumes-comments-user-router.ts │ │ │ │ │ ├── resumes-comments-votes-router.ts │ │ │ │ │ ├── resumes-comments-votes-user-router.ts │ │ │ │ │ ├── resumes-resume-router.ts │ │ │ │ │ ├── resumes-resume-user-router.ts │ │ │ │ │ └── resumes-star-user-router.ts │ │ │ │ ├── todos-user-router.ts │ │ │ │ ├── todos.ts │ │ │ │ └── user-router.ts │ │ │ ├── styles/ │ │ │ │ └── globals.css │ │ │ ├── types/ │ │ │ │ ├── index.d.ts │ │ │ │ ├── next-auth.d.ts │ │ │ │ ├── offers.d.ts │ │ │ │ ├── questions.d.ts │ │ │ │ ├── resume-comments.d.ts │ │ │ │ └── resume.d.ts │ │ │ ├── ui/ │ │ │ │ ├── Alert/ │ │ │ │ │ └── Alert.tsx │ │ │ │ ├── Badge/ │ │ │ │ │ └── Badge.tsx │ │ │ │ ├── Banner/ │ │ │ │ │ └── Banner.tsx │ │ │ │ ├── Button/ │ │ │ │ │ └── Button.tsx │ │ │ │ ├── CheckboxInput/ │ │ │ │ │ └── CheckboxInput.tsx │ │ │ │ ├── CheckboxList/ │ │ │ │ │ └── CheckboxList.tsx │ │ │ │ ├── Collapsible/ │ │ │ │ │ └── Collapsible.tsx │ │ │ │ ├── Dialog/ │ │ │ │ │ └── Dialog.tsx │ │ │ │ ├── DropdownMenu/ │ │ │ │ │ ├── DropdownMenu.tsx │ │ │ │ │ └── DropdownMenuItem.tsx │ │ │ │ ├── HorizontalDivider/ │ │ │ │ │ └── HorizontalDivider.tsx │ │ │ │ ├── Pagination/ │ │ │ │ │ └── Pagination.tsx │ │ │ │ ├── RadioList/ │ │ │ │ │ ├── RadioList.tsx │ │ │ │ │ ├── RadioListContext.ts │ │ │ │ │ └── RadioListItem.tsx │ │ │ │ ├── Select/ │ │ │ │ │ └── Select.tsx │ │ │ │ ├── SlideOut/ │ │ │ │ │ └── SlideOut.tsx │ │ │ │ ├── Spinner/ │ │ │ │ │ └── Spinner.tsx │ │ │ │ ├── Tabs/ │ │ │ │ │ └── Tabs.tsx │ │ │ │ ├── TextArea/ │ │ │ │ │ └── TextArea.tsx │ │ │ │ ├── TextInput/ │ │ │ │ │ └── TextInput.tsx │ │ │ │ ├── Toast/ │ │ │ │ │ ├── Toast.tsx │ │ │ │ │ └── ToastsProvider.tsx │ │ │ │ ├── Typeahead/ │ │ │ │ │ └── Typeahead.tsx │ │ │ │ ├── index.tsx │ │ │ │ └── styles.css │ │ │ └── utils/ │ │ │ ├── JobExperienceLevel.ts │ │ │ ├── offers/ │ │ │ │ ├── analysis/ │ │ │ │ │ ├── analysisGeneration.ts │ │ │ │ │ └── analysisInclusion.ts │ │ │ │ ├── currency/ │ │ │ │ │ ├── CurrencyEnum.tsx │ │ │ │ │ ├── CurrencySelector.tsx │ │ │ │ │ ├── currencyExchange.ts │ │ │ │ │ └── index.tsx │ │ │ │ ├── form.tsx │ │ │ │ ├── link.tsx │ │ │ │ ├── randomGenerator.ts │ │ │ │ ├── randomNameGenerator.ts │ │ │ │ ├── string.tsx │ │ │ │ ├── time.tsx │ │ │ │ ├── useSearchParam.ts │ │ │ │ └── zodRegex.ts │ │ │ ├── questions/ │ │ │ │ ├── RequireAllOrNone.ts │ │ │ │ ├── companySlug.ts │ │ │ │ ├── constants.ts │ │ │ │ ├── createSlug.ts │ │ │ │ ├── locationSlug.ts │ │ │ │ ├── mutations.ts │ │ │ │ ├── relabelQuestionAggregates.ts │ │ │ │ ├── server/ │ │ │ │ │ └── aggregate-encounters.ts │ │ │ │ ├── useDefaultCompany.ts │ │ │ │ ├── useDefaultLocation.ts │ │ │ │ ├── useFormRegister.ts │ │ │ │ ├── useLocationOptions.ts │ │ │ │ ├── useProtectedCallback.ts │ │ │ │ ├── useSearchParam.ts │ │ │ │ ├── vote/ │ │ │ │ │ ├── useAnswerCommentVote.ts │ │ │ │ │ ├── useAnswerVote.ts │ │ │ │ │ ├── useQuestionCommentVote.ts │ │ │ │ │ ├── useQuestionVote.ts │ │ │ │ │ └── useVote.ts │ │ │ │ └── withHref.tsx │ │ │ ├── resumes/ │ │ │ │ ├── resumeFilters.ts │ │ │ │ ├── resumePrismaUtils.ts │ │ │ │ ├── useDebounceValue.ts │ │ │ │ └── useSearchParams.ts │ │ │ ├── shared/ │ │ │ │ ├── useCompanyOptions.ts │ │ │ │ ├── useCountryOptions.ts │ │ │ │ └── useJobTitleOptions.ts │ │ │ ├── supabase.ts │ │ │ └── trpc.ts │ │ ├── tailwind.config.cjs │ │ ├── tsconfig.json │ │ └── vercel.json │ └── website/ │ ├── .gitignore │ ├── .npmrc │ ├── README.md │ ├── blog/ │ │ ├── 2019-11-03-are-front-end-development-enough-for-a-career.md │ │ ├── 2020-05-28-summing-root-to-leaf-numbers.md │ │ ├── 2021-04-12-importance-of-communicating-effectively-as-an-engineer.md │ │ ├── 2021-08-19-facebook-career-questions-and-answers.md │ │ ├── 2021-08-28-front-end-career-questions.md │ │ ├── 2021-08-29-resume-improvement-case-study.md │ │ ├── 2021-08-30-a-glimpse-into-front-end-interviews.md │ │ ├── 2021-10-30-my-experience-working-as-a-meta-engineer.md │ │ ├── 2021-12-23-front-end-vs-back-end-system-design-interviews.md │ │ ├── 2022-04-20-take-control-over-your-coding-interview.md │ │ ├── 2022-04-21-why-you-should-include-debugging-in-the-interview-process.md │ │ ├── 2022-07-09-getting-a-tech-job-as-an-undergraduate.md │ │ └── 2023-05-17-how-to-have-successful-software-engineering-internship.md │ ├── contents/ │ │ ├── _components/ │ │ │ ├── InDocAd.js │ │ │ ├── QuestionGroups.json │ │ │ └── QuestionList.js │ │ ├── _courses/ │ │ │ └── AlgorithmCourses.md │ │ ├── algorithms/ │ │ │ ├── __template__.md │ │ │ ├── array.md │ │ │ ├── binary.md │ │ │ ├── dynamic-programming.md │ │ │ ├── geometry.md │ │ │ ├── graph.md │ │ │ ├── hash-table.md │ │ │ ├── heap.md │ │ │ ├── interval.md │ │ │ ├── linked-list.md │ │ │ ├── math.md │ │ │ ├── matrix.md │ │ │ ├── oop.md │ │ │ ├── queue.md │ │ │ ├── recursion.md │ │ │ ├── sorting-searching.md │ │ │ ├── stack.md │ │ │ ├── string.md │ │ │ ├── study-cheatsheet.md │ │ │ ├── tree.md │ │ │ └── trie.md │ │ ├── behavioral-interview-questions.md │ │ ├── behavioral-interview-rubrics.md │ │ ├── behavioral-interview-senior-candidates.md │ │ ├── behavioral-interview.md │ │ ├── best-coding-interview-courses.md │ │ ├── best-practice-questions.md │ │ ├── career-growth.md │ │ ├── choosing-between-companies.md │ │ ├── coding-interview-cheatsheet.md │ │ ├── coding-interview-prep.md │ │ ├── coding-interview-rubrics.md │ │ ├── coding-interview-study-plan.md │ │ ├── coding-interview-techniques.md │ │ ├── engineering-levels.md │ │ ├── final-questions.md │ │ ├── interview-formats-top-companies.md │ │ ├── interviewer-cheatsheet.md │ │ ├── landscape.md │ │ ├── mock-interviews.md │ │ ├── negotiation-rules.md │ │ ├── negotiation.md │ │ ├── programming-languages-for-coding-interviews.md │ │ ├── resume-old.md │ │ ├── resume.md │ │ ├── self-introduction.md │ │ ├── software-engineering-interview-guide.md │ │ ├── system-design.md │ │ └── understanding-compensation.md │ ├── docusaurus.config.js │ ├── experimental/ │ │ ├── front-end/ │ │ │ └── README.md │ │ ├── topics.md │ │ └── utilities/ │ │ ├── javascript/ │ │ │ ├── binToInt.js │ │ │ ├── binarySearch.js │ │ │ ├── deepEqual.js │ │ │ ├── graphTopoSort.js │ │ │ ├── intToBin.js │ │ │ ├── intervalsIntersect.js │ │ │ ├── intervalsMerge.js │ │ │ ├── isSubsequence.js │ │ │ ├── matrixClone.js │ │ │ ├── matrixTranspose.js │ │ │ ├── matrixTraverse.js │ │ │ ├── mergeSort.js │ │ │ ├── treeEqual.js │ │ │ └── treeMirror.js │ │ └── python/ │ │ ├── binary_search.py │ │ ├── char_prime_map.py │ │ ├── graph_dfs.py │ │ ├── graph_topo_sort.py │ │ ├── heap.py │ │ ├── is_subsequence.py │ │ ├── linked_list.py │ │ ├── quick_select.py │ │ ├── rabin_karp_hash.py │ │ ├── tree_equal.py │ │ ├── tree_mirror.py │ │ ├── tree_traversal.py │ │ ├── trie.py │ │ └── union_find.py │ ├── functions/ │ │ └── grind75/ │ │ └── [[catchall]].js │ ├── package.json │ ├── sidebars.js │ ├── src/ │ │ ├── components/ │ │ │ └── SidebarAd/ │ │ │ ├── index.js │ │ │ └── styles.module.css │ │ ├── css/ │ │ │ └── custom.css │ │ ├── data/ │ │ │ └── successStories.js │ │ ├── pages/ │ │ │ ├── advertise.md │ │ │ ├── index.js │ │ │ └── styles.module.css │ │ └── theme/ │ │ ├── DocItem/ │ │ │ ├── Content/ │ │ │ │ └── index.js │ │ │ └── Layout/ │ │ │ ├── index.js │ │ │ └── styles.module.css │ │ ├── DocSidebar/ │ │ │ └── Mobile/ │ │ │ ├── index.d.ts │ │ │ └── index.js │ │ └── TOC/ │ │ ├── index.js │ │ └── styles.module.css │ └── static/ │ ├── CNAME │ ├── _redirects │ └── ads.txt ├── package.json ├── packages/ │ ├── tailwind-config/ │ │ ├── package.json │ │ └── tailwind.config.js │ └── tsconfig/ │ ├── base.json │ ├── nextjs.json │ ├── package.json │ └── react-library.json ├── pnpm-workspace.yaml └── vite.config.ts ================================================ FILE CONTENTS ================================================ ================================================ FILE: .editorconfig ================================================ root = true [*] end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true [*.{js,py}] charset = utf-8 indent_style = space indent_size = 2 ================================================ FILE: .github/FUNDING.yml ================================================ github: [yangshun] open_collective: tech-interview-handbook custom: https://www.buymeacoffee.com/yangshun ================================================ FILE: .github/workflows/lint.yml ================================================ # Workspace validation using Vite+ name: Check on: pull_request: branches: - main concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true permissions: contents: read jobs: check: name: Check timeout-minutes: 30 runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v6 - name: Set up Vite+ uses: voidzero-dev/setup-vp@v1 with: node-version: '25.8.1' cache: true - name: Installation run: vp install - name: Check run: vp check - name: Test run: vp test ================================================ FILE: .github/workflows/tsc.yml ================================================ # Framework builds using Vite+ task orchestration name: Build on: pull_request: branches: - main concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true permissions: contents: read env: DATABASE_URL: 'postgresql://postgres:password@localhost:5432/postgres' GITHUB_CLIENT_ID: '1234' GITHUB_CLIENT_SECRET: 'abcd' NEXTAUTH_SECRET: 'efgh' NEXTAUTH_URL: 'http://localhost:3000' NODE_ENV: test SUPABASE_ANON_KEY: 'ijkl' SUPABASE_URL: 'https://abcd.supabase.co' jobs: build: name: Build timeout-minutes: 30 runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v6 - name: Set up Vite+ uses: voidzero-dev/setup-vp@v1 with: node-version: '25.8.1' cache: true - name: Installation run: vp install - name: Build website run: vp run --filter @tih/website build - name: Build portal run: vp run --filter @tih/portal build ================================================ FILE: .gitignore ================================================ .idea .DS_Store node_modules .turbo *.log .next dist dist-ssr *.local .env .cache server/dist public/dist .turbo .yarn/* !.yarn/patches !.yarn/plugins !.yarn/releases !.yarn/sdks !.yarn/versions tsconfig.tsbuildinfo ================================================ FILE: .vite-hooks/pre-commit ================================================ vp staged ================================================ FILE: .vscode/extensions.json ================================================ { "recommendations": ["oxc.oxc-vscode"] } ================================================ FILE: .vscode/settings.json ================================================ { "files.trimFinalNewlines": true, "files.trimTrailingWhitespace": true, "cSpell.autoFormatConfigFile": true, "editor.formatOnPaste": true, "editor.formatOnSave": true, "editor.formatOnSaveMode": "file", "javascript.format.enable": true, "json.format.enable": true, "css.format.enable": true, "css.format.newlineBetweenRules": true, "css.format.newlineBetweenSelectors": true, "css.format.preserveNewLines": true, "typescript.format.enable": true, "editor.codeActionsOnSave": { "source.fixAll.oxc": "always" }, "[prisma]": { "editor.defaultFormatter": "Prisma.prisma" } } ================================================ FILE: AGENTS.md ================================================ # Using Vite+, the Unified Toolchain for the Web This project is using Vite+, a unified toolchain built on top of Vite, Rolldown, Vitest, tsdown, Oxlint, Oxfmt, and Vite Task. Vite+ wraps runtime management, package management, and frontend tooling in a single global CLI called `vp`. Vite+ is distinct from Vite, but it invokes Vite through `vp dev` and `vp build`. ## Vite+ Workflow `vp` is a global binary that handles the full development lifecycle. Run `vp help` to print a list of commands and `vp --help` for information about a specific command. ### Start - create - Create a new project from a template - migrate - Migrate an existing project to Vite+ - config - Configure hooks and agent integration - staged - Run linters on staged files - install (`i`) - Install dependencies - env - Manage Node.js versions ### Develop - dev - Run the development server - check - Run format, lint, and TypeScript type checks - lint - Lint code - fmt - Format code - test - Run tests ### Execute - run - Run monorepo tasks - exec - Execute a command from local `node_modules/.bin` - dlx - Execute a package binary without installing it as a dependency - cache - Manage the task cache ### Build - build - Build for production - pack - Build libraries - preview - Preview production build ### Manage Dependencies Vite+ automatically detects and wraps the underlying package manager such as pnpm, npm, or Yarn through the `packageManager` field in `package.json` or package manager-specific lockfiles. - add - Add packages to dependencies - remove (`rm`, `un`, `uninstall`) - Remove packages from dependencies - update (`up`) - Update packages to latest versions - dedupe - Deduplicate dependencies - outdated - Check for outdated packages - list (`ls`) - List installed packages - why (`explain`) - Show why a package is installed - info (`view`, `show`) - View package information from the registry - link (`ln`) / unlink - Manage local package links - pm - Forward a command to the package manager ### Maintain - upgrade - Update `vp` itself to the latest version These commands map to their corresponding tools. For example, `vp dev --port 3000` runs Vite's dev server and works the same as Vite. `vp test` runs JavaScript tests through the bundled Vitest. The version of all tools can be checked using `vp --version`. This is useful when researching documentation, features, and bugs. ## Common Pitfalls - **Using the package manager directly:** Do not use pnpm, npm, or Yarn directly. Vite+ can handle all package manager operations. - **Always use Vite commands to run tools:** Don't attempt to run `vp vitest` or `vp oxlint`. They do not exist. Use `vp test` and `vp lint` instead. - **Running scripts:** Vite+ built-in commands (`vp dev`, `vp build`, `vp test`, etc.) always run the Vite+ built-in tool, not any `package.json` script of the same name. To run a custom script that shares a name with a built-in command, use `vp run A while ago this tweet went viral in the Chinese programming circle. The tweet author used this exact question to screen new grads for an entry-level software engineer position. The tweet and the question were written in Chinese so I translated this question into English. In the tweet, he complained that he was having a hard time understanding (很难理解) why many students came up with the solution that we came up with above. Instead of a straightforward solution with a bunch of `if` statements, he said he was expecting an answer like this: ![alt](https://pbs.twimg.com/media/E_IiA2JVIAcZSSk?format=png&name=900x900) Compared to the first solution with a bunch of `if` statements, this solution, in his opinion, is more **modular, extensible, and maintainable**. That was the answer he had in mind and failing to arrive at this solution means you are weeded out in the interview process. I am not sure how you feel about this, but in my opinion, this is a pretty pointless interview question to ask new grads. The first solution is totally fine. Under the right circumstances, the second solution is closer to what you would want in production code, even though it is still not quite the [table-driven development](#table-driven-development) you'd want. There are so many things I want to unpack, so here is the tl;dr: 1. Different types/styles of interviews call for different answers and that should be clearly communicated during the interview. The first solution is totally fine as the answer to an algorithmic question. 2. Take control of your interview so you don't have to guess what the interviewer has in mind. You do this by asking clarifying questions. **Keep asking until everything the interviewer is looking for is clear to you**. 3. The table-driven method (what the second solution tries to achieve) **optimizes for changes** and that's why the interviewer (the tweet author) failed students who didn't come up with that answer. The overarching theme in this post is that you should take control of your coding interview so you don't have to guess the answer your interviewer is thinking of. ## Different styles of interviews calls for different answers Generally, there are two types of coding interviews: 1. Interviews that focus on **algorithms & data structures** 2. Interviews that focus on **practical app/feature-building** and test your hands-on engineering chops Normally it should be easy to distinguish between these two types of interviews by merely looking at the question: [Inverting a Binary Tree](https://leetcode.com/problems/invert-binary-tree/) is a typical algorithmic question, while designing and implementing an auto-complete search feature is more about practical app-building. Although sometimes the two types of interview questions would blend. For example, you might be asked to (partially) implement a [trie](https://en.wikipedia.org/wiki/Trie) when you are talking about the design of an auto-complete search feature/service/component. But these two different types of interviews are meant to test different competences. In a pure algorithmic, LeetCode-type of interviews, your **main goal** is to leverage the right data structures and come up with an efficient algorithm to solve the problem with the right set of memory/runtime complexity trade-offs **as fast as you can**. How readable, maintainable and extensible your code is, or whether it conforms to the current best practice in the community/industry are _not_ that important, or at least secondary to the main goal. You can go ahead and name your variables `i`, `n`, `p`, `q` and mutate that input array in-place without being judged as long as your solution passes the test cases under the time and memory limits. > As [Joel Spolsky](https://www.joelonsoftware.com/) wrote in his [blog post](https://www.joelonsoftware.com/2006/10/25/the-guerrilla-guide-to-interviewing-version-30/): with the algorithmic interview questions, he wants to see if the candidate is smart enough to "rip through a recursive algorithm in seconds, or implement linked-list manipulation functions using pointers as fast as you can write on the whiteboard". For more experienced engineers/developers, the coding interview tends to lean into the practical app-building category, where **readable, maintainable code and extensible program structure** are what they look for, and all aspects of the full software development life cycle, even including error handling, are fair game to be asked, as they are important in real-world software building. Here I don't make any value judgment about which type of interviews are good or better. I just pointed out that they exist and interviewers look for different things by conducting different types of interviews. ### Take control over the interview As an interviewee, you want to make sure you understand **which category the question falls into** because the underlying core criteria on which you are assessed are different – you don't want to overload the capacity of the working memory of your brain with tasks that are secondary before you reach the main goal. You want to take control over the interview so you are not left in the dark. One way to take control over the interview is to **narrate your thoughts** as you go and **articulate any assumptions** you have to make sure you get confirmation from your interviewer on your way forward or they should help you correct course. If I were the candidate receiving this exact question, I would ask this upfront: "should I write production-grade code with good engineering practices or you are more interested in how I'd tackle the algorithm & data structure part?". That is probably one of the highest ROI questions we can ask during an interview. The interviewer would either tell me to write a workable solution under the constraints of the runtime or space characteristics or treat this as a real-world engineering problem with real-world tradeoffs. ### With all that being said, it is a bad question to ask new grads The question itself doesn't test any of the core competencies that distinguish between brilliant programmers and mediocre ones. What's really being tested here, based on the (ideal) answer the interviewer (the author of the tweet) had in mind, is the whether the candidate – **new CS grads** without any significant experience working in the software industry – knows how to use the table-driven method to implement such a function. I don't believe that any smart college student who can breeze through a graph traversal problem in an interview can't understand and pick up patterns like the table-driven method in just a couple of hours. On the other hand, any mediocre programmers who happened to read _[Code Complete](https://en.wikipedia.org/wiki/Code_Complete)_ can write a table-driven solution and pass the interview. Not to say that knowing good engineering practices is not a good thing; it is just that using that as the **only** hiring criteria to hire new grads is pointless and it doesn't help you find the smart kids.
So what are the ideal interview questions to ask new grads? Joel pointed it out [in his post](https://www.joelonsoftware.com/2006/10/25/the-guerrilla-guide-to-interviewing-version-30/) that the ideal interview questions should cover at least one of these two Computer Science concepts: 1. recursion 2. pointers I actually agree with him on this. You want to ask questions about these two concepts not because they are ubiquitous in your average codebase and you have to use them every day. It is because they are a great tool to test the ability to reason and think in abstractions, the kind of mental aptitude a brilliant programmer would have.
Anyway, the moral of the story is don't be afraid to ask clarifying questions so you don't have to guess what the interviewer looks for and cares about if they are not being explicit about their expectations. > You can stop here if you don't care about technical discussions about this simple interview question. ## Table-driven development Solution 2 resembles a form of table-driven development described in a classic programming book called _[Code Complete](https://en.wikipedia.org/wiki/Code_Complete)_. But even if you have never read the book, you probably know this pattern from your experience working as a software developer/engineer. At its core, it tries to separate **data** from **logic**: instead of having all the information about pricing strategy (the data) hardcoded in the function (the logic) as literal values, it separates them. The pricing strategy is a business rule, and business rules tend to be the source of frequent changes. By encoding that in an external data structure (i.e. the array `priceMap` in this case), we make our program easier to accommodate future changes. Whenever the pricing strategy changes, we can just modify the entries in the array without touching the logic of the function. In other words, we isolate the unstable part, so the effect of a change will be limited. However, I said it only resembles table-driven development that you'd use in production code but it is not quite there yet: 1. The pricing data is not fully separated from the logic as the array `priceMap` is still defined within the function 2. Magic numbers are still there Depending on where the pricing data comes from, one possible variation of the table-driven method for this particular question is as follows: ```javascript // config.js export const priceByRanges = [ { min: 1, max: 5, price: '5' }, { min: 6, max: 10, price: '4' }, { min: 11, max: 20, price: '3' }, { min: 21, max: Number.MAX_SAFE_INTEGER, price: '2.5' }, ]; // app.js import { priceByRanges } from './config.js'; function getPrice(amount) { // error handling for amount outside the range return priceByRanges.find( (priceByRange) => amount >= priceByRange.min && amount <= priceByRange.max, ).price; } ``` Now the pricing data is stored in `config.js` separately and `priceByRanges` is resolved at load time. ### Further optimization If the array `priceByRanges` is always sorted in terms of the price ranges, we can further optimize Solution 2 by leveraging binary search. ```javascript const priceByRanges = [ { min: 1, max: 5, price: '5' }, { min: 6, max: 10, price: '4' }, { min: 11, max: 20, price: '3' }, { min: 21, max: Number.MAX_SAFE_INTEGER, price: '2.5' }, ]; function getPrice(amount) { if (amount < priceByRanges[0].min) { return 'unknown price'; } let start = 0, end = priceByRanges.length - 1; while (start <= end) { const mid = (start + end) >>> 1; if (priceByRanges[mid].max < amount) { start = mid + 1; } else { end = mid - 1; } } return priceByRanges[start].price; } ```
What is this >>>? `>>>` is binary right shift by 1 position, which is effectively just a division by 2 followed with a `Math.floor`. e.g. for 11: 1011 -> 101 results to 5.
### Notes on performance and Big O It might feel that the first clumsy solution with a bunch of `if` blocks is better in terms of the performance than the second table-driven approach that _loops_ through the array. Actually for the Big O analysis, both approaches have the **same constant time complexity**, as the number of operations (i.e. comparision between `amount` and the price range), doesn't grow no matter how big the input is (i.e. `amount`). What's more interesting, in my opinion, is the performance implications between using a loop vs. "unrolling" the loop. By unrolling I mean discretely writing line-by-line of the loop body. [A quick google search](https://stackoverflow.com/questions/38111355/javascript-are-loops-faster-than-discretely-writing-line-by-line) suggests that popular JavaScript engines such as V8 heavily optimize loops. But getting any accurate results from such a micro-benchmarking is really hard as the performance varies a lot depending on different factors like the engine and the code in the loop body. ================================================ FILE: apps/website/blog/2022-04-21-why-you-should-include-debugging-in-the-interview-process.md ================================================ --- title: Why You Should Include Debugging In The Interview Process slug: why-you-should-include-debugging-in-the-interview-process author: Zhenghao He author_title: Senior Software Engineer at Instacart, ex-Amazon author_url: https://twitter.com/he_zhenghao author_image_url: /img/authors/zhenghao.jpg tags: [interview, debugging] ---
:::tip See discussions on [Hacker News](https://news.ycombinator.com/item?id=31125269) ::: ## Most technical interviews are over-indexing on coding Over the past two years, I have interviewed with over 10 different tech companies ranging from hot startups like Coinbase, Stripe, and Instacart to FAANG companies like Amazon and Meta, for Software Engineer positions of various levels. The technical interview processes I have had all consisted of at least two rounds of coding interviews, where I either had to solve an **algorithmic, LeetCode-type** question or build a **practical app/feature**. During those coding interviews, I always started with an _empty slate_: if it was an algorithm-heavy interview question, there would be a literally empty file in the editor for me to start writing code; if it was a practical app building exercise, there might be some boilerplate code or some utilities/helper functions available but still I was expected to build the app/feature from scratch. I do think they did a good job at assessing my coding ability. But the issue I see here is that the standard interview process in our industry has over-indexed on coding ability along. As a software engineer, apart from meetings and writing design docs, I’d say at least half of my programming work isn’t just coding – the other half largely involves searching through a codebase and reading existing code or code-adjacent artifacts like error messages, tests, and logs. And oftentimes, coding isn’t the hardest part. ## What is programming exactly Programming is a complex task so it makes sense to dissect it so we can study the different phases, dimensions and components of it individually. I have been reading [_The Programmer's Brain_](https://www.manning.com/books/the-programmers-brain) by Felienne Hermans. It is a book about the cognitive process involved in programming. Felienne divides programming into five more concrete activities: **searching, comprehension, transcribing, incrementation, and exploration**. Searching is the activity where a programmer is looking for a specific piece of information in a codebase, such as the precise location of a bug you need to fix in the code. Comprehension is reading the code to understand its functionality and the way it is intended to work. It also involves executing the code and observing the results. Transcribing is about converting your thoughts or solutions to executable code. This is what we usually refer to as **"coding"** and is what the current standard coding interview process only focuses on. Incrementation is about incrementing (iterating) on an existing codebase, such as adding a new feature. It is a mix of the previous activities, where a programmer has to search, comprehend and transcribe their thoughts to code. Exploration is sketching and prototyping with code. Try things and use code as a means of thought. It is also a mix of the previous activities. With this newfound knowledge, it is not hard to tell what exactly the current standard interview process lacks. Activities such as searching and comprehension are completely left out and you have no way to prove your competencies needed for a big part of a software engineer job. It begs the question of what we can do to complement the interview process to cover all these activities. And the answer is to add a **debugging interview** in the process. ## Debugging is all-encompassing When one is debugging, they engage in **all five activities**. It entails a sequence of searching, comprehension, exploration and writing code. And it is incredibly revealing to watch one debug: 1. Are they debugging with a plan, iteratively bisecting the code or just randomly tweaking the code? 2. How are they navigating their way through an unfamiliar codebase, forming different hypotheses about the bug? 3. Do they try to write a test that reliably reproduces the issue? 4. Are they able to find where things are diverging and trace to the root cause? 5. Are they familiar with the IDE or editor they are using and know how to use tools like breakpoints and watches to step through the code? 6. Do they understand how to read error messages and leverage stack traces? 7. Are they able to implement a fix at the end? 8. ...the list goes on and on On top of its comprehensiveness, debugging is what software engineers do on a regular basis. It is relevant to the actual work. Out of all the companies I have interviewed for, _only_ Stripe conducted a debugging interview. They call it Bug Squash, where you’d dive into a large, well-written library codebase to fix real-world open-source bugs. I had a blast going through that interview which I can’t say about boring LeetCode questions. Granted, preparing such a debugging interview involves more work for the company than just throwing a LeetCode question at the candidate. Still, having that in the process gives you more signals for selecting capable, experienced engineers. I hope more companies start to embrace that in their hiring process. ## Further reading that can make you better at debugging - [_Debugging: The 9 Indispensable Rules for Finding Even the Most Elusive Software and Hardware Problems_](https://www.goodreads.com/book/show/3938178-debugging) by Dave Agans - [_Debugging Software_](https://blog.isquaredsoftware.com/2021/06/presentations-debugging-software/) by Mark Erikson - [_How I got better at debugging_](https://jvns.ca/blog/2015/11/22/how-i-got-better-at-debugging/) by Julia Evans ================================================ FILE: apps/website/blog/2022-07-09-getting-a-tech-job-as-an-undergraduate.md ================================================ --- title: Getting a Tech Job as an Undergraduate slug: getting-a-tech-job-as-an-undergraduate author: Melody Yun author_title: RCG Software Engineer at PayPal author_url: https://github.com/caramelmelmel author_image_url: https://github.com/caramelmelmel.png tags: [undergraduate, career, job search] hide_table_of_contents: true --- Recently, I have met many juniors and peers especially from non-computer Science related backgrounds asking me about securing a job as a fresh graduate especially in this area of software engineering. Here's my take and some tips and tricks to get started. Before I share my resources and how to get a gentle start on this handbook, let me warn you that you would need to allocate a minimum of 6 months to get really good and confident with some of the LeetCode questions. Do not neglect the behavioral questions too! I am not going to repeat some of the things that are mentioned in this handbook but rather help everyone with some useful shortcuts of mine to navigate this resource to ease your preparations. ## Crafting your resume In most companies, the resume stage is the most important as it is the first stage that you will need to clear! For undergraduates, most hiring managers would only look at resumes that are within one page. The moment the second page is seen, they will not tend to consider. Hence, here are some tips that can help you to prepare your resume in under an hour to reduce your agony. 1. Use a career hiring tool like [Kinobi](https://kinobi.tech/resume). Kinobi saves you time in having to fix alignments unlike word as this career tool formats everything for you. Furthermore, they help you to score your resume so that you know where you stand when applying for a job. 2. As far as possible, attend career talks by your favorite companies because hiring managers are there and you can get some feedback about your resume. It is indeed helpful because you know what to look out for when applying. 3. Keep your sentences short and sweet, else you are out of the game. - Good example: "Developed a full-stack website that garnered positive responses from faculty and administration about course visualization." You need not provide tech stacks and let alone, links here. The sentence here is short and sweet and all in past tense. - Bad example: "Was a project manager for two projects- AI_ducation as well as the lift project for ALEF. Helped day-to-day operations by communicating with clients in Mandarin to map business requirements to technical requirements.". Over here, the sentence is long and things can be separated out into points. Furthermore, it does not describe the outcome of the project enough to say "Why should you be hired?". 4. To save time, while building your projects, apply good practices and also think of various optimizations in terms of algorithmic design, not forgetting system design. You can also show this off and this saved me a lot of time especially when it comes to grinding LeetCode. 5. Your LinkedIn stands out the most and less of your personal website unless it's design related or frontend related. Write more things that are still succinct on your LinkedIn. Show your work there and let recruiters interact with your work. 6. ATS-friendly resumes are the most important ones as recruiters screen high volumes of candidates everyday so they have less than even 5 seconds to look at your resume. Some companies use ATS to scan for good keywords. ## How to use the Tech Interview Handbook easily I am about to recommend relevant sections to go in sequentially and how to systematically use them to your advantage especially in being real productive. This stage is normally faced when the resume stage has passed. Even then, months of prior preparation has to be done. However if you only have one month to prepare, I suggest the following tips: 1. Know your interview process. Ask your recruiter about the interview process. 2. Go to your Glassdoor page and pick out some of the past relevant interview questions that your company has done to get a gauge of what to expect. If you are unable to do those past questions, I suggest revising a good amount about the common topics. One common topic is array and hash table design. You can refer to the [coding interview rubrics section](/coding-interview-rubrics/) get to know your interview rubrics. It helps and you know what to do. 3. Know and try various techniques for each LeetCode question. It's not purely about variety but more about if you were to even come back to the same question, will you be able to give a more optimal solution? If you don't know where to get started especially when solving problems in general refer to this [coding interview techniques section](/coding-interview-techniques/). - Start with a whiteboard or pen and paper. Show your thought process. - In most companies, if you were to show your thought process while doing, interviewers tend to favour candidates who do this. If you are not confident, start thinking that you are explaining and teaching a 12 year old child about how to solve this question. - Code it out and write your own test cases. Get used to the HackerRank or LeetCode IDEs. - Now with virtual interviews, some companies tend to use HackerRank live to conduct whiteboard interviews. Prepare a pen and paper beside you as you work along. Prepare to remote desktop protocol (RDP) into your computer to show step-by-step workings. - Do not blurt out the solution straightaway as interviewers can tell that you memorize. 4. Last but not least for algorithms heavy interviews, you might really want to save your time looking at [Grind 75](https://www.techinterviewhandbook.org/grind75/). It's a useful curated source of questions to note how much you can prepare for your interview. 5. Always be prepared for even system design questions! You will never know what comes your way and this is where your projects come in and how much of good practices you apply in them and what do you learn. The [System Design Primer](https://github.com/donnemartin/system-design-primer) is a good start. ## Do not neglect behavioral interview questions Most candidates at least from what I know, tend to neglect this section. As a result, they pass up good opportunities because of this section. I suggest reading Cracking the Coding Interview, which explains this section very well in detail. Here are some preparations that you can do before the interview. 1. Draw up a table in this format. This is so that you know what to say when a question about your projects come up. | | Project 1 | Project 2 | | ------------- | --------- | --------- | | Strength 1 | | | | Strength 2 | | | | Weakness 1 | | | | Weakness 2 | | | | Improvement 1 | | | | Improvement 2 | | | 2. For those with portfolio websites, do be prepared to answer "What do you think can be done better to improve your website?" I highly suggest inspecting your console and using UI/UX principles to state the improvements. It would be also good for front end engineering roles to state how you can better engineer your website. 3. When preparing, do not focus your answers heavily on your team. Instead, the interviewers want to see how you have grown as an individual and the difficulties that you encounter. Be also prepared to stand strong on your answers and do not give an "I think" vibes to the interviewer. They will tend to have a bad impression. 4. Certain companies go by rubrics for this and they do not disclose this! However, always be humble and thank the interviewers for helping even if you are unable to justify. ## Interview day As always, have a goodnight sleep before and adjust your sleep cycle at least 3 days prior. If you do not know where to start form, start from a brute force solution and manipulate the data structure to your advantage. Most interviewers like optimized solutions but they like how you can design a simple solution to the problem! ## Conclusion All the best in your preparations! Hope my shortcuts help for those of you who are extremely busy! ================================================ FILE: apps/website/blog/2023-05-17-how-to-have-successful-software-engineering-internship.md ================================================ --- title: How to have a Successful Software Engineering Internship slug: how-to-have-successful-software-engineering-internship author: Yangshun Tay author_title: Ex-Staff Engineer at Meta author_url: https://github.com/yangshun author_image_url: https://github.com/yangshun.png tags: [career, facebook, meta] image: /img/meta-facebook.jpg hide_table_of_contents: true --- Since summer internships are round the corner, I figured it'd be useful to share some tips for interns to have a successful internship. Having mentored a few interns who and seen many examples of successful interns at Meta, I observed a list of traits that successful interns demonstrate. At the end of the internship, a good litmus test on whether your internship was successful is whether the team would hire you or take their chances with someone else. ## Recommended Intern Behaviors ### 1. Do what is expected of you Firstly in order to do what is expected of you, you need to know what is expected of you. If you're a SWE intern, most of the time you need to complete a given project before the end of the internship by writing high quality code. Look at how code is written in the code base and follow existing conventions, directory structure, naming, use existing abstractions. Break your code into small PRs so that it's easy to review. Write tests and test your code thoroughly before submitting for review. ### 2. Demonstrate independence Your intern manager/mentor/host is also a busy employee and they have their own work to do. If you run into issues, try to unblock yourself first before asking someone. Look up internal documentation, refer to existing code and see if you can follow similar approaches. If you're still stuck, then ask. Post in support groups/chats and share your high level goal, the approaches you've tried and why they didn't work. This helps people to help you. It's ok to ask more questions at the start but the frequency should go down over time. ### 3. Take initiative and ownership of your project Rather than waiting for tasks to be handed to you, look at the plan/roadmap (or create one if it doesn't exist) and work through the tasks. Break down the project and create tasks for yourself, closing them when completed. Be your own project manager and product manager. Anticipate blockers where possible and unblock yourself ahead of time. Keep a log of the work you've done. This will be super useful if you have to write a self evaluation at the end of your internship. ### 4. Communicate You are the best advocate of your work. In large companies, peer feedback is taken into account for the internship evaluation so it'd be good if more people knew about your work. Tell your team what you are doing, make occasional updates about your work, give others visibility into your work and demo your work during sprint retros. Communicate if you are unblocked or if you don't feel like you're heading in the right direction. ### 5. Ask for and address feedback Your mentor should already be providing you feedback constantly and you should address them in the remaining time you have. If your company doesn't have the open feedback culture, you can ask your mentor or teammates when you get the chance. Ask how you can improve and what you can do better. Since you'll be spending lots of time writing code, make sure you pay attention to the code review comments and that your reviewers don't have to make the same comment twice. ### 6. Assess the company As much as an internship is an extended interview of your fit for the company, it is also a chance for you to interview the company. Do you enjoy the team's and company's working style? Do they overwork their employees and treat employees with respect? Sometimes interns can be too busy with their projects to pay attention to these things but ultimately these are important factors to take into consideration when deciding whether to sign the return offer. You might not be joining back the same team but the company culture affects the team's culture to some extent. ## Rockstar Interns Your performance during the internship will affect the offer you're given. At Meta, the top interns (< 10%), or what we commonly refer to as "rockstar interns" were given out-of-the-band offers that enter the L4 (mid-level) salary range, where few other big tech companies can match. I've encountered some of them throughout my time at Meta and Grab and they're all doing really well in their careers now. Here's what they did: ### 1. Overdeliver There are a few ways to overdeliver, by completing things faster, doing more things, or doing them better. This intern did all of that and completed the intern project even before the mid-point review (6 weeks in, out of a 12-week internship) and spent the remaining time working on things beyond the intern project. ### 2. Review code As part of the project, the intern became familiar with certain features owned by the team. Usually interns are the most junior members of the team, but this intern became such an expert that they were able to review code of not just fellow interns, but also full-time members of the team, making meaningful suggestions and spotting bugs during code review. ### 3. Refactor code This intern saw that there was a similar component that could help achieve their task, but not without some changes. Instead of duplicating the code for their own use case, they refactored it such that it could be used in the current callsite and also their work. ### 4. Provide customer support to users This intern was working on an internal tool and adding an entirely new feature to it. Before that, they had to understand how the internal tool worked. As a result, they became extremely familiar with the tool and was helping to answer questions from users all over the company. Some were shocked to find out that it was an intern that helped them with their issue. ### 5. Oncall Being oncall is a responsibility of being available outside of regular working hours to respond to urgent issues with a product with the goal of addressing issues promptly and minimizing downtime and full-time engineers take turns to be oncall. This intern understood the team's work so well after a few weeks that the team trusted them to be added to the oncall rotation. They were able to pull this off by exploring beyond their assigned project, reading lots of the team's code and being familiar with the operations of the team. ### 6. Have time for side projects This intern was not from my team, but someone I knew prior to them joining the company. They completed their assigned work so fast and was constantly bored, and they asked if they could help me with my work. I was working on some code modernization efforts and they wrote a codemod (script to do AST-based code modifications) to help me complete my refactoring work in a fraction of the time. They were able to dive into a code base outside of their team, entirely new stack (front end) and make impact. Mindblown. Most of these interns had something in common, they functioned like a full-time member of the team. The primary goal of internships is to convert interns to full-time. Interns who exhibit behaviors of full-time employees will come out on top. Naturally these intern got the top ratings and one of them was even selected to have dinner with Mark Zuckerberg, a privilege only a handful of the top interns had. However, it's also important to note that one has to complete their core project / responsibilities before striving for brownie points. The core project is the cake and these behaviors are icing on the cake. You can't just have icing without a cake. --- It goes without saying that the above is non-exhaustive, but hopefully these tips and examples will be helpful! ================================================ FILE: apps/website/contents/_components/InDocAd.js ================================================ import React from 'react'; import SidebarAd from '@site/src/components/SidebarAd'; export default function InDocAd() { return (
); } ================================================ FILE: apps/website/contents/_components/QuestionGroups.json ================================================ { "Week 1": [ { "slug": "two-sum", "title": "Two Sum", "url": "https://leetcode.com/problems/two-sum/", "duration": 15, "epi": null, "difficulty": "Easy", "id": 1, "topic": "array", "routines": ["hashing"] }, { "slug": "valid-parentheses", "title": "Valid Parentheses", "url": "https://leetcode.com/problems/valid-parentheses/", "duration": 20, "epi": 3, "difficulty": "Easy", "id": 20, "topic": "stack", "routines": [] }, { "slug": "merge-two-sorted-lists", "title": "Merge Two Sorted Lists", "url": "https://leetcode.com/problems/merge-two-sorted-lists/", "duration": 20, "epi": 0, "difficulty": "Easy", "id": 21, "topic": "linked-list", "routines": [] }, { "slug": "best-time-to-buy-and-sell-stock", "title": "Best Time to Buy and Sell Stock", "url": "https://leetcode.com/problems/best-time-to-buy-and-sell-stock/", "duration": 20, "epi": 0, "difficulty": "Easy", "id": 121, "topic": "array", "routines": [] }, { "slug": "valid-palindrome", "title": "Valid Palindrome", "url": "https://leetcode.com/problems/valid-palindrome/", "duration": 15, "epi": 2, "difficulty": "Easy", "id": 125, "topic": "string", "routines": ["palindrome"] }, { "slug": "invert-binary-tree", "title": "Invert Binary Tree", "url": "https://leetcode.com/problems/invert-binary-tree/", "duration": 15, "epi": null, "difficulty": "Easy", "id": 226, "topic": "binary-tree", "routines": [] }, { "slug": "valid-anagram", "title": "Valid Anagram", "url": "https://leetcode.com/problems/valid-anagram/", "duration": 15, "epi": null, "difficulty": "Easy", "id": 242, "topic": "string", "routines": ["anagram"] }, { "slug": "binary-search", "title": "Binary Search", "url": "https://leetcode.com/problems/binary-search/", "duration": 15, "epi": null, "difficulty": "Easy", "id": 792, "topic": "binary-search", "routines": [] }, { "slug": "flood-fill", "title": "Flood Fill", "url": "https://leetcode.com/problems/flood-fill/", "duration": 20, "epi": 2, "difficulty": "Easy", "id": 733, "topic": "graph", "routines": ["matrix", "depth-first-search"] }, { "slug": "lowest-common-ancestor-of-a-binary-search-tree", "title": "Lowest Common Ancestor of a Binary Search Tree", "url": "https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/", "duration": 20, "epi": 1, "difficulty": "Easy", "id": 235, "topic": "binary-search-tree", "routines": [] }, { "slug": "balanced-binary-tree", "title": "Balanced Binary Tree", "url": "https://leetcode.com/problems/balanced-binary-tree/", "duration": 15, "epi": 0, "difficulty": "Easy", "id": 110, "topic": "binary-tree", "routines": [] }, { "slug": "linked-list-cycle", "title": "Linked List Cycle", "url": "https://leetcode.com/problems/linked-list-cycle/", "duration": 20, "epi": 1, "difficulty": "Easy", "id": 141, "topic": "linked-list", "routines": ["two-pointers"] } ], "Week 2": [ { "slug": "implement-queue-using-stacks", "title": "Implement Queue using Stacks", "url": "https://leetcode.com/problems/implement-queue-using-stacks/", "duration": 20, "epi": 3, "difficulty": "Easy", "id": 232, "topic": "stack", "routines": [] }, { "slug": "first-bad-version", "title": "First Bad Version", "url": "https://leetcode.com/problems/first-bad-version/", "duration": 20, "epi": null, "difficulty": "Easy", "id": 278, "topic": "binary-search", "routines": [] }, { "slug": "ransom-note", "title": "Ransom Note", "url": "https://leetcode.com/problems/ransom-note/", "duration": 15, "epi": 0, "difficulty": "Easy", "id": 383, "topic": "hash-table", "routines": [] }, { "slug": "climbing-stairs", "title": "Climbing Stairs", "url": "https://leetcode.com/problems/climbing-stairs/", "duration": 20, "epi": null, "difficulty": "Easy", "id": 70, "topic": "dynamic-programming", "routines": [] }, { "slug": "longest-palindrome", "title": "Longest Palindrome", "url": "https://leetcode.com/problems/longest-palindrome/", "duration": 20, "epi": 2, "difficulty": "Easy", "id": 409, "topic": "string", "routines": ["palindrome"] }, { "slug": "reverse-linked-list", "title": "Reverse Linked List", "url": "https://leetcode.com/problems/reverse-linked-list/", "duration": 20, "epi": 1, "difficulty": "Easy", "id": 206, "topic": "linked-list", "routines": [] }, { "slug": "majority-element", "title": "Majority Element", "url": "https://leetcode.com/problems/majority-element/", "duration": 20, "epi": 2, "difficulty": "Easy", "id": 169, "topic": "array", "routines": ["sorting"] }, { "slug": "add-binary", "title": "Add Binary", "url": "https://leetcode.com/problems/add-binary/", "duration": 15, "epi": null, "difficulty": "Easy", "id": 67, "topic": "binary", "routines": [] }, { "slug": "diameter-of-binary-tree", "title": "Diameter of Binary Tree", "url": "https://leetcode.com/problems/diameter-of-binary-tree/", "duration": 30, "epi": null, "difficulty": "Easy", "id": 543, "topic": "binary-tree", "routines": [] }, { "slug": "middle-of-the-linked-list", "title": "Middle of the Linked List", "url": "https://leetcode.com/problems/middle-of-the-linked-list/", "duration": 20, "epi": null, "difficulty": "Easy", "id": 908, "topic": "linked-list", "routines": ["two-pointers"] }, { "slug": "maximum-depth-of-binary-tree", "title": "Maximum Depth of Binary Tree", "url": "https://leetcode.com/problems/maximum-depth-of-binary-tree/", "duration": 15, "epi": null, "difficulty": "Easy", "id": 104, "topic": "binary-tree", "routines": [] }, { "slug": "contains-duplicate", "title": "Contains Duplicate", "url": "https://leetcode.com/problems/contains-duplicate/", "duration": 15, "epi": null, "difficulty": "Easy", "id": 217, "topic": "array", "routines": ["hash-table", "sorting"] } ], "Week 3": [ { "slug": "min-stack", "title": "Min Stack", "url": "https://leetcode.com/problems/min-stack/", "duration": 20, "epi": 0, "difficulty": "Medium", "id": 155, "topic": "stack", "routines": [] }, { "slug": "maximum-subarray", "title": "Maximum Subarray", "url": "https://leetcode.com/problems/maximum-subarray/", "duration": 20, "epi": null, "difficulty": "Medium", "id": 53, "topic": "dynamic-programming", "routines": [] }, { "slug": "insert-interval", "title": "Insert Interval", "url": "https://leetcode.com/problems/insert-interval/", "duration": 25, "epi": null, "difficulty": "Medium", "id": 57, "topic": "array", "routines": ["interval"] }, { "slug": "01-matrix", "title": "01 Matrix", "url": "https://leetcode.com/problems/01-matrix/", "duration": 30, "epi": null, "difficulty": "Medium", "id": 542, "topic": "graph", "routines": ["breadth-first-search"] }, { "slug": "k-closest-points-to-origin", "title": "K Closest Points to Origin", "url": "https://leetcode.com/problems/k-closest-points-to-origin/", "duration": 30, "epi": 1, "difficulty": "Medium", "id": 1014, "topic": "heap", "routines": ["geometry"] }, { "slug": "longest-substring-without-repeating-characters", "title": "Longest Substring Without Repeating Characters", "url": "https://leetcode.com/problems/longest-substring-without-repeating-characters/", "duration": 30, "epi": null, "difficulty": "Medium", "id": 3, "topic": "string", "routines": ["sliding-window"] }, { "slug": "3sum", "title": "3Sum", "url": "https://leetcode.com/problems/3sum/", "duration": 30, "epi": 0, "difficulty": "Medium", "id": 15, "topic": "array", "routines": ["two-pointers"] }, { "slug": "binary-tree-level-order-traversal", "title": "Binary Tree Level Order Traversal", "url": "https://leetcode.com/problems/binary-tree-level-order-traversal/", "duration": 20, "epi": 1, "difficulty": "Medium", "id": 102, "topic": "binary-tree", "routines": [] }, { "slug": "clone-graph", "title": "Clone Graph", "url": "https://leetcode.com/problems/clone-graph/", "duration": 25, "epi": null, "difficulty": "Medium", "id": 133, "topic": "graph", "routines": ["depth-first-search", "breadth-first-search"] }, { "slug": "evaluate-reverse-polish-notation", "title": "Evaluate Reverse Polish Notation", "url": "https://leetcode.com/problems/evaluate-reverse-polish-notation/", "duration": 30, "epi": 2, "difficulty": "Medium", "id": 150, "topic": "stack", "routines": [] } ], "Week 4": [ { "slug": "course-schedule", "title": "Course Schedule", "url": "https://leetcode.com/problems/course-schedule/", "duration": 30, "epi": null, "difficulty": "Medium", "id": 207, "topic": "graph", "routines": ["topo-sort"] }, { "slug": "implement-trie-prefix-tree", "title": "Implement Trie (Prefix Tree)", "url": "https://leetcode.com/problems/implement-trie-prefix-tree/", "duration": 35, "epi": null, "difficulty": "Medium", "id": 208, "topic": "trie", "routines": [] }, { "slug": "coin-change", "title": "Coin Change", "url": "https://leetcode.com/problems/coin-change/", "duration": 25, "epi": null, "difficulty": "Medium", "id": 322, "topic": "dynamic-programming", "routines": [] }, { "slug": "product-of-array-except-self", "title": "Product of Array Except Self", "url": "https://leetcode.com/problems/product-of-array-except-self/", "duration": 30, "epi": null, "difficulty": "Medium", "id": 238, "topic": "array", "routines": ["prefix-sum"] }, { "slug": "validate-binary-search-tree", "title": "Validate Binary Search Tree", "url": "https://leetcode.com/problems/validate-binary-search-tree/", "duration": 20, "epi": null, "difficulty": "Medium", "id": 98, "topic": "binary-search-tree", "routines": [] }, { "slug": "number-of-islands", "title": "Number of Islands", "url": "https://leetcode.com/problems/number-of-islands/", "duration": 25, "epi": null, "difficulty": "Medium", "id": 200, "topic": "graph", "routines": ["depth-first-search", " breadth-first-search"] }, { "slug": "rotting-oranges", "title": "Rotting Oranges", "url": "https://leetcode.com/problems/rotting-oranges/", "duration": 30, "epi": null, "difficulty": "Medium", "id": 1036, "topic": "graph", "routines": ["breadth-first-search"] }, { "slug": "search-in-rotated-sorted-array", "title": "Search in Rotated Sorted Array", "url": "https://leetcode.com/problems/search-in-rotated-sorted-array/", "duration": 30, "epi": 2, "difficulty": "Medium", "id": 33, "topic": "binary-search", "routines": [] } ], "Week 5": [ { "slug": "combination-sum", "title": "Combination Sum", "url": "https://leetcode.com/problems/combination-sum/", "duration": 30, "epi": null, "difficulty": "Medium", "id": 39, "topic": "array", "routines": ["backtracking"] }, { "slug": "permutations", "title": "Permutations", "url": "https://leetcode.com/problems/permutations/", "duration": 30, "epi": 2, "difficulty": "Medium", "id": 46, "topic": "recursion", "routines": ["backtracking"] }, { "slug": "merge-intervals", "title": "Merge Intervals", "url": "https://leetcode.com/problems/merge-intervals/", "duration": 30, "epi": 3, "difficulty": "Medium", "id": 56, "topic": "array", "routines": ["interval"] }, { "slug": "lowest-common-ancestor-of-a-binary-tree", "title": "Lowest Common Ancestor of a Binary Tree", "url": "https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/", "duration": 25, "epi": null, "difficulty": "Medium", "id": 236, "topic": "binary-tree", "routines": [] }, { "slug": "time-based-key-value-store", "title": "Time Based Key-Value Store", "url": "https://leetcode.com/problems/time-based-key-value-store/", "duration": 35, "epi": null, "difficulty": "Medium", "id": 1023, "topic": "binary-search", "routines": [] }, { "slug": "accounts-merge", "title": "Accounts Merge", "url": "https://leetcode.com/problems/accounts-merge/", "duration": 30, "epi": null, "difficulty": "Medium", "id": 721, "topic": "graph", "routines": ["depth-first-search", "union-find"] }, { "slug": "sort-colors", "title": "Sort Colors", "url": "https://leetcode.com/problems/sort-colors/", "duration": 25, "epi": 0, "difficulty": "Medium", "id": 75, "topic": "array", "routines": ["two-pointers"] }, { "slug": "word-break", "title": "Word Break", "url": "https://leetcode.com/problems/word-break/", "duration": 30, "epi": 2, "difficulty": "Medium", "id": 139, "topic": "trie", "routines": [] } ], "Week 6": [ { "slug": "partition-equal-subset-sum", "title": "Partition Equal Subset Sum", "url": "https://leetcode.com/problems/partition-equal-subset-sum/", "duration": 30, "epi": 2, "difficulty": "Medium", "id": 416, "topic": "dynamic-programming", "routines": [] }, { "slug": "string-to-integer-atoi", "title": "String to Integer (atoi)", "url": "https://leetcode.com/problems/string-to-integer-atoi/", "duration": 25, "epi": 0, "difficulty": "Medium", "id": 8, "topic": "string", "routines": [] }, { "slug": "spiral-matrix", "title": "Spiral Matrix", "url": "https://leetcode.com/problems/spiral-matrix/", "duration": 25, "epi": 1, "difficulty": "Medium", "id": 54, "topic": "matrix", "routines": [] }, { "slug": "subsets", "title": "Subsets", "url": "https://leetcode.com/problems/subsets/", "duration": 30, "epi": 3, "difficulty": "Medium", "id": 78, "topic": "recursion", "routines": ["backtracking"] }, { "slug": "binary-tree-right-side-view", "title": "Binary Tree Right Side View", "url": "https://leetcode.com/problems/binary-tree-right-side-view/", "duration": 20, "epi": null, "difficulty": "Medium", "id": 199, "topic": "binary-tree", "routines": [] }, { "slug": "longest-palindromic-substring", "title": "Longest Palindromic Substring", "url": "https://leetcode.com/problems/longest-palindromic-substring/", "duration": 25, "epi": null, "difficulty": "Medium", "id": 5, "topic": "string", "routines": ["palindrome", "two-pointer", "dynamic-programming"] }, { "slug": "unique-paths", "title": "Unique Paths", "url": "https://leetcode.com/problems/unique-paths/", "duration": 20, "epi": 2, "difficulty": "Medium", "id": 62, "topic": "dynamic-programming", "routines": [] }, { "slug": "construct-binary-tree-from-preorder-and-inorder-traversal", "title": "Construct Binary Tree from Preorder and Inorder Traversal", "url": "https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/", "duration": 25, "epi": 2, "difficulty": "Medium", "id": 105, "topic": "binary-tree", "routines": [] }, { "slug": "container-with-most-water", "title": "Container With Most Water", "url": "https://leetcode.com/problems/container-with-most-water/", "duration": 35, "epi": 2, "difficulty": "Medium", "id": 11, "topic": "array", "routines": ["greedy", "two-pointers"] } ], "Week 7": [ { "slug": "letter-combinations-of-a-phone-number", "title": "Letter Combinations of a Phone Number", "url": "https://leetcode.com/problems/letter-combinations-of-a-phone-number/", "duration": 30, "epi": 3, "difficulty": "Medium", "id": 17, "topic": "recursion", "routines": ["backtracking"] }, { "slug": "word-search", "title": "Word Search", "url": "https://leetcode.com/problems/word-search/", "duration": 30, "epi": null, "difficulty": "Medium", "id": 79, "topic": "graph", "routines": ["backtracking"] }, { "slug": "find-all-anagrams-in-a-string", "title": "Find All Anagrams in a String", "url": "https://leetcode.com/problems/find-all-anagrams-in-a-string/", "duration": 30, "epi": null, "difficulty": "Medium", "id": 438, "topic": "string", "routines": ["anagram"] }, { "slug": "minimum-height-trees", "title": "Minimum Height Trees", "url": "https://leetcode.com/problems/minimum-height-trees/", "duration": 30, "epi": null, "difficulty": "Medium", "id": 310, "topic": "graph", "routines": ["topo-sort"] }, { "slug": "task-scheduler", "title": "Task Scheduler", "url": "https://leetcode.com/problems/task-scheduler/", "duration": 35, "epi": null, "difficulty": "Medium", "id": 621, "topic": "heap", "routines": [] }, { "slug": "lru-cache", "title": "LRU Cache", "url": "https://leetcode.com/problems/lru-cache/", "duration": 30, "epi": null, "difficulty": "Medium", "id": 146, "topic": "linked-list", "routines": ["hash-table"] }, { "slug": "kth-smallest-element-in-a-bst", "title": "Kth Smallest Element in a BST", "url": "https://leetcode.com/problems/kth-smallest-element-in-a-bst/", "duration": 25, "epi": null, "difficulty": "Medium", "id": 230, "topic": "binary-search-tree", "routines": [] }, { "slug": "minimum-window-substring", "title": "Minimum Window Substring", "url": "https://leetcode.com/problems/minimum-window-substring/", "duration": 30, "epi": 3, "difficulty": "Hard", "id": 76, "topic": "string", "routines": ["sliding-window"] } ], "Week 8": [ { "slug": "serialize-and-deserialize-binary-tree", "title": "Serialize and Deserialize Binary Tree", "url": "https://leetcode.com/problems/serialize-and-deserialize-binary-tree/", "duration": 40, "epi": null, "difficulty": "Hard", "id": 297, "topic": "binary-tree", "routines": [] }, { "slug": "trapping-rain-water", "title": "Trapping Rain Water", "url": "https://leetcode.com/problems/trapping-rain-water/", "duration": 35, "epi": null, "difficulty": "Hard", "id": 42, "topic": "stack", "routines": ["monotonic-stack"] }, { "slug": "find-median-from-data-stream", "title": "Find Median from Data Stream", "url": "https://leetcode.com/problems/find-median-from-data-stream/", "duration": 30, "epi": 3, "difficulty": "Hard", "id": 295, "topic": "heap", "routines": [] }, { "slug": "word-ladder", "title": "Word Ladder", "url": "https://leetcode.com/problems/word-ladder/", "duration": 45, "epi": null, "difficulty": "Hard", "id": 127, "topic": "graph", "routines": ["breadth-first-search"] }, { "slug": "basic-calculator", "title": "Basic Calculator", "url": "https://leetcode.com/problems/basic-calculator/", "duration": 40, "epi": null, "difficulty": "Hard", "id": 224, "topic": "stack", "routines": ["parsing"] }, { "slug": "maximum-profit-in-job-scheduling", "title": "Maximum Profit in Job Scheduling", "url": "https://leetcode.com/problems/maximum-profit-in-job-scheduling/", "duration": 45, "epi": null, "difficulty": "Hard", "id": 1352, "topic": "binary-search", "routines": ["dynamic-programming"] }, { "slug": "merge-k-sorted-lists", "title": "Merge k Sorted Lists", "url": "https://leetcode.com/problems/merge-k-sorted-lists/", "duration": 30, "epi": null, "difficulty": "Hard", "id": 23, "topic": "heap", "routines": [] }, { "slug": "largest-rectangle-in-histogram", "title": "Largest Rectangle in Histogram", "url": "https://leetcode.com/problems/largest-rectangle-in-histogram/", "duration": 35, "epi": 3, "difficulty": "Hard", "id": 84, "topic": "stack", "routines": ["monotonic-stack"] } ] } ================================================ FILE: apps/website/contents/_components/QuestionList.js ================================================ import React from 'react'; import QuestionGroups from './QuestionGroups.json'; function DifficultyLabel({ difficulty }) { return ( {difficulty} ); } export default function QuestionList() { return (
{Object.entries(QuestionGroups).map( ([sectionTitle, questions], index) => (

Week {index + 5}

{questions.map((question) => ( ))}
Problem Difficulty Duration
{question.title} {question.duration} mins
), )}
); } ================================================ FILE: apps/website/contents/_courses/AlgorithmCourses.md ================================================ ### [AlgoMonster](https://shareasale.com/r.cfm?b=1873647&u=3114753&m=114505&urllink=&afftrack=) AlgoMonster aims to help you ace the technical interview **in the shortest time possible**. By Google engineers, AlgoMonster uses a data-driven approach to teach you the most useful key question patterns and has contents to help you quickly revise basic data structures and algorithms. Best of all, AlgoMonster is not subscription-based - pay a one-time fee and get **lifetime access**. [**Join today for a 70% discount →**](https://shareasale.com/r.cfm?b=1873647&u=3114753&m=114505&urllink=&afftrack=) ### [Grokking the Coding Interview: Patterns for Coding Questions](https://www.designgurus.io/course/grokking-the-coding-interview?aff=kJSIoU) This course on by Design Gurus expands upon the questions on the recommended practice questions but approaches the practicing from a questions pattern perspective, which is an approach I also agree with for learning and have personally used to get better at coding interviews. The course allows you to practice selected questions in Java, Python, C++, JavaScript and also provides sample solutions in those languages along with step-by-step visualizations. **Learn and understand patterns, not memorize answers!** [**Get lifetime access now →**](https://www.designgurus.io/course/grokking-the-coding-interview?aff=kJSIoU) ### [Master the Coding Interview: Data Structures + Algorithms](https://www.udemy.com/course/master-the-coding-interview-data-structures-algorithms/) This Udemy bestseller is one of the highest-rated interview preparation course (4.6 stars, 21.5k ratings, 135k students) and packs **19 hours** worth of contents into it. Like Tech Interview Handbook, it goes beyond coding interviews and covers resume, non-technical interviews, negotiations. It's an all-in-one package! Note that JavaScript is being used for the coding demos. [**Check it out →**](https://www.udemy.com/course/master-the-coding-interview-data-structures-algorithms/) ================================================ FILE: apps/website/contents/algorithms/__template__.md ================================================ - [ ] introduction.md - [x] array.md - [x] string.md - [x] sorting-searching.md - [x] recursion.md - [x] hash-table.md - [x] linked-list.md - [x] stack.md - [x] queue.md - [x] matrix.md - [x] graph.md - [x] interval.md - [x] tree.md - [x] heap.md - [x] trie.md - [x] geometry.md - [x] math.md - [x] dynamic-programming.md - [x] binary.md ## Introduction TODO ## Learning resources TODO ## Implementations | Language | API | | ---------- | ---- | | C++ | []() | | Java | []() | | Python | []() | | JavaScript | []() | ## Time complexity TODO | Operation | Big-O | Note | | --------- | ----- | ---- | | Access | O(n) | | | Search | O(n) | | | Insert | O(1) | | | Remove | O(1) | | ## Things to look out for during interviews TODO ## Corner cases TODO ## Techniques TODO ## Essential questions _These are essential questions to practice if you're studying for this topic._ TODO ## Recommended practice questions _These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._ TODO ================================================ FILE: apps/website/contents/algorithms/array.md ================================================ --- id: array title: Array cheatsheet for coding interviews description: Array study guide for coding interviews, including practice questions, techniques, time complexity, and recommended resources keywords: [ array coding interview study guide, array tips for coding interviews, array practice questions, array useful techniques, array time complexity, array recommended study resources, ] sidebar_label: Array toc_max_heading_level: 2 --- ## Introduction Arrays hold values of the same type at contiguous memory locations. In an array, we're usually concerned about two things - the position/index of an element and the element itself. Different programming languages implement arrays under the hood differently and can affect the time complexity of operations you make to the array. In some languages like Python, JavaScript, Ruby, PHP, the array (or list in Python) size is dynamic and you do not need to have a size defined beforehand when creating the array. As a result, people usually have an easier time using these languages for interviews. Arrays are among the most common data structures encountered during interviews. Questions which ask about other topics would likely involve arrays/sequences as well. Mastery of array is essential for interviews! **Advantages** - Store multiple elements of the same type with one single variable name - Accessing elements is fast as long as you have the index, as opposed to [linked lists](./linked-list.md) where you have to traverse from the head. **Disadvantages** - Addition and removal of elements into/from the middle of an array is slow because the remaining elements need to be shifted to accommodate the new/missing element. An exception to this is if the position to be inserted/removed is at the end of the array. - For certain languages where the array size is fixed, it cannot alter its size after initialization. If an insertion causes the total number of elements to exceed the size, a new array has to be allocated and the existing elements have to be copied over. The act of creating a new array and transferring elements over takes O(n) time. ## Learning resources - Readings - [Array in Data Structure: What is, Arrays Operations](https://www.guru99.com/array-data-structure.html), Guru99 - Videos - [Arrays](https://www.coursera.org/lecture/data-structures/arrays-OsBSF), University of California San Diego ## Common terms Common terms you see when doing problems involving arrays: - Subarray - A range of contiguous values within an array. - Example: given an array `[2, 3, 6, 1, 5, 4]`, `[3, 6, 1]` is a subarray while `[3, 1, 5]` is not a subarray. - Subsequence - A sequence that can be derived from the given sequence by deleting some or no elements without changing the order of the remaining elements. - Example: given an array `[2, 3, 6, 1, 5, 4]`, `[3, 1, 5]` is a subsequence but `[3, 5, 1]` is not a subsequence. ## Time complexity | Operation | Big-O | Note | | --- | --- | --- | | Access | O(1) | | | Search | O(n) | | | Search (sorted array) | O(log(n)) | | | Insert | O(n) | Insertion would require shifting all the subsequent elements to the right by one and that takes O(n) | | Insert (at the end) | O(1) | Special case of insertion where no other element needs to be shifted | | Remove | O(n) | Removal would require shifting all the subsequent elements to the left by one and that takes O(n) | | Remove (at the end) | O(1) | Special case of removal where no other element needs to be shifted | ## Things to look out for during interviews - Clarify if there are duplicate values in the array. Would the presence of duplicate values affect the answer? Does it make the question simpler or harder? - When using an index to iterate through array elements, be careful not to go out of bounds. - Be mindful about slicing or concatenating arrays in your code. Typically, slicing and concatenating arrays would take O(n) time. Use start and end indices to demarcate a subarray/range where possible. ## Corner cases - Empty sequence - Sequence with 1 or 2 elements - Sequence with repeated elements - Duplicated values in the sequence ## Techniques Note that because both arrays and strings are sequences (a string is an array of characters), most of the techniques here will apply to string problems. ### Sliding window Master the [sliding window technique](https://leetcode.com/problems/minimum-window-substring/solutions/26808/here-is-a-10-line-template-that-can-solve-most-substring-problems/) that applies to many subarray/substring problems. In a sliding window, the two pointers usually move in the same direction will never overtake each other. This ensures that each value is only visited at most twice and the time complexity is still O(n). Examples: [Longest Substring Without Repeating Characters](https://leetcode.com/problems/longest-substring-without-repeating-characters/), [Minimum Size Subarray Sum](https://leetcode.com/problems/minimum-size-subarray-sum/), [Minimum Window Substring](https://leetcode.com/problems/minimum-window-substring/) ### Two pointers Two pointers is a more general version of sliding window where the pointers can cross each other and can be on different arrays. Examples: [Sort Colors](https://leetcode.com/problems/sort-colors/), [Palindromic Substrings](https://leetcode.com/problems/palindromic-substrings/) When you are given two arrays to process, it is common to have one index per array (pointer) to traverse/compare the both of them, incrementing one of the pointers when relevant. For example, we use this approach to merge two sorted arrays. Examples: [Merge Sorted Array](https://leetcode.com/problems/merge-sorted-array/) ### Traversing from the right Sometimes you can traverse the array starting from the right instead of the conventional approach of from the left. Examples: [Daily Temperatures](https://leetcode.com/problems/daily-temperatures/), [Number of Visible People in a Queue](https://leetcode.com/problems/number-of-visible-people-in-a-queue/) ### Sorting the array Is the array sorted or partially sorted? If it is, some form of binary search should be possible. This also usually means that the interviewer is looking for a solution that is faster than O(n). Can you sort the array? Sometimes sorting the array first may significantly simplify the problem. Obviously this would not work if the order of array elements need to be preserved. Examples: [Merge Intervals](https://leetcode.com/problems/merge-intervals/), [Non-overlapping Intervals](https://leetcode.com/problems/non-overlapping-intervals/) ### Precomputation For questions where summation or multiplication of a subarray is involved, pre-computation using hashing or a prefix/suffix sum/product might be useful. Examples: [Product of Array Except Self](https://leetcode.com/problems/product-of-array-except-self/), [Minimum Size Subarray Sum](https://leetcode.com/problems/minimum-size-subarray-sum/), [LeetCode questions tagged "prefix-sum"](https://leetcode.com/problem-list/prefix-sum/) ### Index as a hash key If you are given a sequence and the interviewer asks for O(1) space, it might be possible to use the array itself as a hash table. For example, if the array only has values from 1 to N, where N is the length of the array, negate the value at that index (minus one) to indicate presence of that number. Examples: [First Missing Positive](https://leetcode.com/problems/first-missing-positive/), [Daily Temperatures](https://leetcode.com/problems/daily-temperatures/) ### Traversing the array more than once This might be obvious, but traversing the array twice/thrice (as long as fewer than n times) is still O(n). Sometimes traversing the array more than once can help you solve the problem while keeping the time complexity to O(n). ## Essential questions _These are essential questions to practice if you're studying for this topic._ - [Two Sum](https://leetcode.com/problems/two-sum/) - [Best Time to Buy and Sell Stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/) - [Product of Array Except Self](https://leetcode.com/problems/product-of-array-except-self/) - [Maximum Subarray](https://leetcode.com/problems/maximum-subarray/) ## Recommended practice questions _These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._ - [Contains Duplicate](https://leetcode.com/problems/contains-duplicate/) - [Maximum Product Subarray](https://leetcode.com/problems/maximum-product-subarray/) - [Search in Rotated Sorted Array](https://leetcode.com/problems/search-in-rotated-sorted-array/) - [3Sum](https://leetcode.com/problems/3sum/) - [Container With Most Water](https://leetcode.com/problems/container-with-most-water/) - [Sliding Window Maximum](https://leetcode.com/problems/sliding-window-maximum/) ## Recommended courses import AlgorithmCourses from '../\_courses/AlgorithmCourses.md' ================================================ FILE: apps/website/contents/algorithms/binary.md ================================================ --- id: binary title: Binary cheatsheet for coding interviews description: binary study guide for coding interviews, including practice questions, techniques, time complexity, and recommended resources keywords: [ binary coding interview study guide, binary tips for coding interviews, binary practice questions, binary useful techniques, binary time complexity, binary recommended study resources, ] sidebar_label: Binary toc_max_heading_level: 2 --- ## Introduction Knowledge of binary number system and bit manipulation is less important in coding interviews as most Software Engineers do not have to deal with bits, which is more commonly used when dealing with lower level systems and programming languages. They are still asked sometimes, so you should at least still know how to convert a number from decimal form into binary form (and vice versa) in your chosen programming language. ## Learning resources - Readings - [Bits, Bytes, Building With Binary](https://medium.com/basecs/bits-bytes-building-with-binary-13cb4289aafa), basecs - [Bitwise operation](https://en.wikipedia.org/wiki/Bitwise_operation), Wikipedia - Videos - [Algorithms: Bit Manipulation](https://www.youtube.com/watch?v=NLKQEOgBAnw), HackerRank - Practice - [Practice with bit operations](https://pconrad.github.io/old_pconrad_cs16/topics/bitOps/) ## Corner cases - Be aware and check for overflow/underflow - Negative numbers ## Techniques Questions involving binary representations and bitwise operations are asked sometimes and you must be absolutely familiar with how to convert a number from decimal form into binary form (and vice versa) in your chosen programming language. Some helpful utility snippets: | Technique | Code | | --- | --- | | Test kth bit is set | `num & (1 << k) != 0` | | Set kth bit | num |= (1 << k) | | Turn off kth bit | `num &= ~(1 << k)` | | Toggle the kth bit | `num ^= (1 << k)` | | Multiply by 2k | `num << k` | | Divide by 2k | `num >> k` | | Check if a number is a power of 2 | `(num & num - 1) == 0` or `(num & (-num)) == num` | | Swapping two variables | `num1 ^= num2; num2 ^= num1; num1 ^= num2` | ## Essential questions _These are essential questions to practice if you're studying for this topic._ - [Sum of Two Integers](https://leetcode.com/problems/sum-of-two-integers/) - [Number of 1 Bits](https://leetcode.com/problems/number-of-1-bits/) ## Recommended practice questions _These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._ - [Counting Bits](https://leetcode.com/problems/counting-bits/) - [Missing Number](https://leetcode.com/problems/missing-number/) - [Reverse Bits](https://leetcode.com/problems/reverse-bits/) - [Single Number](https://leetcode.com/problems/single-number/) ## Recommended courses import AlgorithmCourses from '../\_courses/AlgorithmCourses.md' ================================================ FILE: apps/website/contents/algorithms/dynamic-programming.md ================================================ --- id: dynamic-programming title: Dynamic programming cheatsheet for coding interviews description: Dynamic programming study guide for coding interviews, including practice questions, techniques, time complexity, and recommended resources keywords: [ dynamic programming coding interview study guide, dynamic programming tips for coding interviews, dynamic programming practice questions, dynamic programming useful techniques, dynamic programming time complexity, dynamic programming recommended study resources, ] sidebar_label: Dynamic programming toc_max_heading_level: 2 --- ## Introduction Dynamic Programming (DP) is usually used to solve optimization problems. The only way to get better at DP is to practice. It takes some amount of practice to be able to recognize that a problem can be solved by DP. ## Learning resources - [Demystifying Dynamic Programming](https://www.freecodecamp.org/news/demystifying-dynamic-programming-3efafb8d4296) - [Dynamic Programming – 7 Steps to Solve any DP Interview Problem](https://dev.to/nikolaotasevic/dynamic-programming--7-steps-to-solve-any-dp-interview-problem-3870) - [Less Repetition, More Dynamic Programming](https://medium.com/basecs/less-repetition-more-dynamic-programming-43d29830a630), basecs - [Dynamic Programming](http://www.cs.yale.edu/homes/aspnes/classes/223/notes.html#dynamicProgramming), James Aspnes, Yale University ## Techniques Sometimes you do not need to store the whole DP table in memory, the last two values or the last two rows of the matrix will suffice. ## Essential questions _These are essential questions to practice if you're studying for this topic._ - [Climbing Stairs](https://leetcode.com/problems/climbing-stairs/) - [Coin Change](https://leetcode.com/problems/coin-change/) - [House Robber](https://leetcode.com/problems/house-robber/) - [Longest Increasing Subsequence](https://leetcode.com/problems/longest-increasing-subsequence/) ## Recommended practice questions _These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._ - [0/1 Knapsack or Partition Equal Subset Sum](https://leetcode.com/problems/partition-equal-subset-sum/) - [Longest Common Subsequence](https://leetcode.com/problems/longest-common-subsequence/) - [Word Break Problem](https://leetcode.com/problems/word-break/) - [Combination Sum](https://leetcode.com/problems/combination-sum-iv/) - [House Robber II](https://leetcode.com/problems/house-robber-ii/) - [Decode Ways](https://leetcode.com/problems/decode-ways/) - [Unique Paths](https://leetcode.com/problems/unique-paths/) - [Jump Game](https://leetcode.com/problems/jump-game/) ## Recommended courses import AlgorithmCourses from '../\_courses/AlgorithmCourses.md' ### [Grokking Dynamic Programming Patterns for Coding Interviews](https://www.designgurus.io/course/grokking-dynamic-programming?aff=kJSIoU) Brought to you by the same folks behind the famous ["Grokking the Coding Interview"](https://www.designgurus.io/course/grokking-the-coding-interview?aff=kJSIoU), this is one of the rare few courses focused on helping you get better at Dynamic Programming questions. If you are interviewing for companies who are famous for asking Dynamic Programming questions (-cough- Google -cough-), this course should be helpful. ================================================ FILE: apps/website/contents/algorithms/geometry.md ================================================ --- id: geometry title: Geometry cheatsheet for coding interviews description: Geometry study guide for coding interviews, including practice questions, techniques, time complexity, and recommended resources keywords: [ geometry coding interview study guide, geometry tips for coding interviews, geometry practice questions, geometry useful techniques, geometry time complexity, geometry recommended study resources, ] sidebar_label: Geometry toc_max_heading_level: 2 --- ## Introduction Geometry is a branch of mathematics that is concerned with properties of space that are related with distance, shape, size, and relative position of figures. Advanced geometry (e.g. 3D geometry) is not taught in most Computer Science courses, so you can expect that you will only be asked on 2D geometry. In algorithm interviews, geometry is usually not be the focus of the problem (you're not being evaluated on mathematics after all). You typically have to use other algorithms and/or data structures in the problem. ## Corner cases - Zero values. This always gets people. ## Techniques ### Distance between two points When comparing the distance between two points, using dx2 + dy2 is sufficient. It is unnecessary to square root the value. Examples: [K Closest Points to Origin](https://leetcode.com/problems/k-closest-points-to-origin/) ### Overlapping circles To find out if two circles overlap, check that the distance between the two centers of the circles is less than the sum of their radii. ### Overlapping rectangles Two rectangles overlap if the following is true: ```py overlap = rect_a.left < rect_b.right and \ rect_a.right > rect_b.left and \ rect_a.top > rect_b.bottom and \ rect_a.bottom < rect_b.top ``` Here's a [nice visualization](https://silentmatt.com/rectangle-intersection/). Examples: [Rectangle Overlap](https://leetcode.com/problems/rectangle-overlap/) ## Sample questions - You have a plane with lots of rectangles on it, find out how many of them intersect. - Which data structure would you use to query the k-nearest points of a set on a 2D plane? - Given many points, find k points that are closest to the origin. - How would you triangulate a polygon? ## Essential questions _These are essential questions to practice if you're studying for this topic._ - [Rectangle Overlap](https://leetcode.com/problems/rectangle-overlap/) ## Recommended practice questions _These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._ - [K Closest Points to Origin](https://leetcode.com/problems/k-closest-points-to-origin/) - [Rectangle Area](https://leetcode.com/problems/rectangle-area/) ## Recommended courses import AlgorithmCourses from '../\_courses/AlgorithmCourses.md' ================================================ FILE: apps/website/contents/algorithms/graph.md ================================================ --- id: graph title: Graph cheatsheet for coding interviews description: Graph study guide for coding interviews, including practice questions, techniques, time complexity, and recommended resources keywords: [ graph coding interview study guide, graph tips for coding interviews, graph practice questions, graph useful techniques, graph time complexity, graph recommended study resources, ] sidebar_label: Graph toc_max_heading_level: 2 --- ## Introduction A graph is a structure containing a set of objects (nodes or vertices) where there can be edges between these nodes/vertices. Edges can be directed or undirected and can optionally have values (a weighted graph). Trees are undirected graphs in which any two vertices are connected by exactly one edge and there can be no cycles in the graph. Graphs are commonly used to model relationship between unordered entities, such as - Friendship between people - Each node is a person and edges between nodes represent that these two people are friends. - Distances between locations - Each node is a location and the edge between nodes represent that these locations are connected. The value of the edge represents the distance. Be familiar with the various graph representations, graph search algorithms and their time and space complexities. ## Learning resources - Readings - [From Theory To Practice: Representing Graphs](https://medium.com/basecs/from-theory-to-practice-representing-graphs-cfd782c5be38), basecs - [Deep Dive Through A Graph: DFS Traversal](https://medium.com/basecs/deep-dive-through-a-graph-dfs-traversal-8177df5d0f13), basecs - [Going Broad In A Graph: BFS Traversal](https://medium.com/basecs/going-broad-in-a-graph-bfs-traversal-959bd1a09255), basecs - Additional (only if you have time) - [Finding The Shortest Path, With A Little Help From Dijkstra](https://medium.com/basecs/finding-the-shortest-path-with-a-little-help-from-dijkstra-613149fbdc8e), basecs - [Spinning Around In Cycles With Directed Acyclic Graphs](https://medium.com/basecs/spinning-around-in-cycles-with-directed-acyclic-graphs-a233496d4688), basecs ## Graph representations You can be given a list of edges and you have to build your own graph from the edges so that you can perform a traversal on them. The common graph representations are: - Adjacency matrix - Adjacency list - Hash table of hash tables Using a hash table of hash tables would be the simplest approach during algorithm interviews. It will be rare that you have to use an adjacency matrix or list for graph questions during interviews. In algorithm interviews, graphs are commonly given in the input as 2D matrices where cells are the nodes and each cell can traverse to its adjacent cells (up/down/left/right). Hence it is important that you be familiar with traversing a 2D matrix. When traversing the matrix, always ensure that your current position is within the boundary of the matrix and has not been visited before. ## Time complexity `|V|` is the number of vertices while `|E|` is the number of edges. | Algorithm | Big-O | | -------------------- | -------------------------------- | | Depth-first search | O(|V| + |E|) | | Breadth-first search | O(|V| + |E|) | | Topological sort | O(|V| + |E|) | ## Things to look out for during interviews - A tree-like diagram could very well be a graph that allows for cycles and a naive recursive solution would not work. In that case you will have to handle cycles and keep a set of visited nodes when traversing. - Ensure you are correctly keeping track of visited nodes and not visiting each node more than once. Otherwise your code could end up in an infinite loop. ## Corner cases - Empty graph - Graph with one or two nodes - Disconnected graphs - Graph with cycles ## Graph search algorithms - **Common** - Breadth-first Search, Depth-first Search - **Uncommon** - Topological Sort, Dijkstra's algorithm - **Almost never** - Bellman-Ford algorithm, Floyd-Warshall algorithm, Prim's algorithm, Kruskal's algorithm. Your interviewer likely doesn't know them either. ### Depth-first search Depth-first search is a graph traversal algorithm which explores as far as possible along each branch before backtracking. A stack is usually used to keep track of the nodes that are on the current search path. This can be done either by an implicit [recursion](./recursion.md) stack, or an actual [stack](./stack.md) data structure. A simple template for doing depth-first searches on a matrix goes like this: ```py def dfs(matrix): # Check for an empty matrix/graph. if not matrix: return [] rows, cols = len(matrix), len(matrix[0]) visited = set() directions = ((0, 1), (0, -1), (1, 0), (-1, 0)) def traverse(i, j): if (i, j) in visited: return visited.add((i, j)) # Traverse neighbors. for direction in directions: next_i, next_j = i + direction[0], j + direction[1] if 0 <= next_i < rows and 0 <= next_j < cols: # Add in question-specific checks, where relevant. traverse(next_i, next_j) for i in range(rows): for j in range(cols): traverse(i, j) ``` ### Breadth-first search Breadth-first search is a graph traversal algorithm which starts at a node and explores all nodes at the present depth, before moving on to the nodes at the next depth level. A [queue](./queue.md) is usually used to keep track of the nodes that were encountered but not yet explored. A similar template for doing breadth-first searches on the matrix goes like this. It is important to use double-ended queues and not arrays/Python lists as dequeuing for double-ended queues is O(1) but it's O(n) for arrays. ```py from collections import deque def bfs(matrix): # Check for an empty matrix/graph. if not matrix: return [] rows, cols = len(matrix), len(matrix[0]) visited = set() directions = ((0, 1), (0, -1), (1, 0), (-1, 0)) def traverse(i, j): queue = deque([(i, j)]) while queue: curr_i, curr_j = queue.popleft() if (curr_i, curr_j) not in visited: visited.add((curr_i, curr_j)) # Traverse neighbors. for direction in directions: next_i, next_j = curr_i + direction[0], curr_j + direction[1] if 0 <= next_i < rows and 0 <= next_j < cols: # Add in question-specific checks, where relevant. queue.append((next_i, next_j)) for i in range(rows): for j in range(cols): traverse(i, j) ``` :::info While DFS is implemented using recursion in this sample, it could also be implemented iteratively similar to BFS. The key difference between the algorithms lies in the underlying data structure (BFS uses a queue while DFS uses a stack). The `deque` class in Python can function as both a stack and a queue. ::: For additional tips on BFS and DFS, you can refer to this [LeetCode post](https://leetcode.com/problems/pacific-atlantic-water-flow/solutions/90774/Python-solution-with-detailed-explanation/) ### Topological sorting A topological sort or topological ordering of a directed graph is a linear ordering of its vertices such that for every directed edge uv from vertex u to vertex v, u comes before v in the ordering. Precisely, a topological sort is a graph traversal in which each node v is visited only after all its dependencies are visited. Topological sorting is most commonly used for scheduling a sequence of jobs or tasks which has dependencies on other jobs/tasks. The jobs are represented by vertices, and there is an edge from x to y if job x must be completed before job y can be started. Another example is taking courses in university where courses have pre-requisites. Here's an example where the edges is an array of two-value tuples and the first value depends on the second value. ```py def graph_topo_sort(num_nodes, edges): from collections import deque nodes, order, queue = {}, [], deque() for node_id in range(num_nodes): nodes[node_id] = { 'in': 0, 'out': set() } for node_id, pre_id in edges: nodes[node_id]['in'] += 1 nodes[pre_id]['out'].add(node_id) for node_id in nodes.keys(): if nodes[node_id]['in'] == 0: queue.append(node_id) while len(queue): node_id = queue.popleft() for outgoing_id in nodes[node_id]['out']: nodes[outgoing_id]['in'] -= 1 if nodes[outgoing_id]['in'] == 0: queue.append(outgoing_id) order.append(node_id) return order if len(order) == num_nodes else None print(graph_topo_sort(4, [[0, 1], [0, 2], [2, 1], [3, 0]])) # [1, 2, 0, 3] ``` ## Essential questions _These are essential questions to practice if you're studying for this topic._ - [Number of Islands](https://leetcode.com/problems/number-of-islands/) - [Flood Fill](https://leetcode.com/problems/flood-fill/) - [01 Matrix](https://leetcode.com/problems/01-matrix/) ## Recommended practice questions _These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._ - Breadth-first search - [Rotting Oranges](https://leetcode.com/problems/rotting-oranges/) - [Minimum Knight Moves (LeetCode Premium)](https://leetcode.com/problems/minimum-knight-moves/) - Either search - [Clone Graph](https://leetcode.com/problems/clone-graph/) - [Pacific Atlantic Water Flow](https://leetcode.com/problems/pacific-atlantic-water-flow/) - [Number of Connected Components in an Undirected Graph (LeetCode Premium)](https://leetcode.com/problems/number-of-connected-components-in-an-undirected-graph/) - [Graph Valid Tree (LeetCode Premium)](https://leetcode.com/problems/graph-valid-tree/) - Topological sorting - [Course Schedule](https://leetcode.com/problems/course-schedule/) - [Alien Dictionary (LeetCode Premium)](https://leetcode.com/problems/alien-dictionary/) ## Recommended courses import AlgorithmCourses from '../\_courses/AlgorithmCourses.md' ================================================ FILE: apps/website/contents/algorithms/hash-table.md ================================================ --- id: hash-table title: Hash table cheatsheet for coding interviews description: Hash table study guide for coding interviews, including practice questions, techniques, time complexity, and recommended resources keywords: [ hash table coding interview study guide, hash table tips for coding interviews, hash table practice questions, hash table useful techniques, hash table time complexity, hash table recommended study resources, ] sidebar_label: Hash table toc_max_heading_level: 2 --- ## Introduction A hash table (commonly referred to as hash map) is a data structure that implements an associative array abstract data type, a structure that can map keys to values. A hash table uses a hash function on an element to compute an index, also called a hash code, into an array of buckets or slots, from which the desired value can be found. During lookup, the key is hashed and the resulting hash indicates where the corresponding value is stored. Hashing is the most common example of a space-time tradeoff. Instead of linearly searching an array every time to determine if an element is present, which takes O(n) time, we can traverse the array once and hash all the elements into a hash table. Determining if the element is present is a simple matter of hashing the element and seeing if it exists in the hash table, which is O(1) on average. In the case of hash collisions, there are a number of collision resolution techniques that can be used. You will unlikely be asked about details of collision resolution techniques in interviews: - **Separate chaining** - A linked list is used for each value, so that it stores all the collided items. - **Open addressing** - All entry records are stored in the bucket array itself. When a new entry has to be inserted, the buckets are examined, starting with the hashed-to slot and proceeding in some probe sequence, until an unoccupied slot is found. ## Learning resources - Readings - [Taking Hash Tables Off The Shelf](https://medium.com/basecs/taking-hash-tables-off-the-shelf-139cbf4752f0), basecs - [Hashing Out Hash Functions](https://medium.com/basecs/hashing-out-hash-functions-ea5dd8beb4dd), basecs - Videos - [Core: Hash Tables](https://www.coursera.org/lecture/data-structures-optimizing-performance/core-hash-tables-m7UuP), University of California San Diego - [A Brief Guide to Hash Tables](https://www.youtube.com/watch?v=r1XZGP5ppqQ) ([slides](https://samuelalbanie.com/files/digest-slides/2022-09-brief-guide-to-hash-tables.pdf)), Samuel Albanie, University of Cambridge ## Implementations | Language | API | | --- | --- | | C++ | [`std::unordered_map`](https://learn.microsoft.com/en-us/cpp/standard-library/unordered-map?view=msvc-170) | | Java | [`java.util.Map`](https://docs.oracle.com/javase/10/docs/api/java/util/Map.html). Use [`java.util.HashMap`](https://docs.oracle.com/javase/10/docs/api/java/util/HashMap.html) | | Python | [`dict`](https://docs.python.org/3/tutorial/datastructures.html#dictionaries) | | JavaScript | [`Object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) or [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) | ## Time complexity | Operation | Big-O | Note | | --------- | ------ | ---------------------------------------------------- | | Access | N/A | Accessing not possible as the hash code is not known | | Search | O(1)\* | | | Insert | O(1)\* | | | Remove | O(1)\* | | _\* This is the average case, but in interviews we only care about the average case for hash tables._ ## Sample questions - Describe an implementation of a least-used cache, and big-O notation of it. - A question involving an API's integration with hash map where the buckets of hash map are made up of linked lists. ## Essential questions _These are essential questions to practice if you're studying for this topic._ - [Two Sum](https://leetcode.com/problems/two-sum/) - [Ransom Note](https://leetcode.com/problems/ransom-note/) ## Recommended practice questions _These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._ - [Group Anagrams](https://leetcode.com/problems/group-anagrams/) - [Insert Delete GetRandom O(1)](https://leetcode.com/problems/insert-delete-getrandom-o1/) - [First Missing Positive](https://leetcode.com/problems/first-missing-positive/) - [LRU Cache](https://leetcode.com/problems/lru-cache/) - [All O one Data Structure](https://leetcode.com/problems/all-oone-data-structure/) ## Recommended courses import AlgorithmCourses from '../\_courses/AlgorithmCourses.md' ================================================ FILE: apps/website/contents/algorithms/heap.md ================================================ --- id: heap title: Heap cheatsheet for coding interviews description: Heap study guide for coding interviews, including practice questions, techniques, time complexity, and recommended resources keywords: [ heap coding interview study guide, heap tips for coding interviews, heap practice questions, heap useful techniques, heap time complexity, heap recommended study resources, ] sidebar_label: Heap toc_max_heading_level: 2 --- ## Introduction A heap is a specialized tree-based data structure which is a complete tree that satisfies the heap property. - Max heap - In a max heap, the value of a node must be greatest among the node values in its entire subtree. The same property must be recursively true for all nodes in the tree. - Min heap - In a min heap, the value of a node must be smallest among the node values in its entire subtree. The same property must be recursively true for all nodes in the tree. In the context of algorithm interviews, heaps and priority queues can be treated as the same data structure. A heap is a useful data structure when it is necessary to repeatedly remove the object with the highest (or lowest) priority, or when insertions need to be interspersed with removals of the root node. ## Learning resources - [Learning to Love Heaps](https://medium.com/basecs/learning-to-love-heaps-cef2b273a238), basecs - [Heapify All The Things With Heap Sort](https://medium.com/basecs/heapify-all-the-things-with-heap-sort-55ee1c93af82), basecs - [Heaps](http://www.cs.yale.edu/homes/aspnes/classes/223/notes.html#heaps), James Aspnes, Yale University ## Implementations | Language | API | | --- | --- | | C++ | [`std::priority_queue`](https://learn.microsoft.com/en-us/cpp/standard-library/priority-queue-class?view=msvc-170) | | Java | [`java.util.PriorityQueue`](https://docs.oracle.com/javase/10/docs/api/java/util/PriorityQueue.html) | | Python | [`heapq`](https://docs.python.org/3/library/heapq.html) | | JavaScript | N/A | ## Time complexity | Operation | Big-O | | ------------------------------------------------------ | --------- | | Find max/min | O(1) | | Insert | O(log(n)) | | Remove | O(log(n)) | | Heapify (create a heap out of given array of elements) | O(n) | ## Techniques ### Mention of `k` If you see a top or lowest _k_ being mentioned in the question, it is usually a signal that a heap can be used to solve the problem, such as in [Top K Frequent Elements](https://leetcode.com/problems/top-k-frequent-elements/). If you require the top _k_ elements use a Min Heap of size _k_. Iterate through each element, pushing it into the heap (for python `heapq`, invert the value before pushing to find the max). Whenever the heap size exceeds _k_, remove the minimum element, that will guarantee that you have the _k_ largest elements. ## Essential questions _These are essential questions to practice if you're studying for this topic._ - [Merge K Sorted Lists](https://leetcode.com/problems/merge-k-sorted-lists/) - [K Closest Points to Origin](https://leetcode.com/problems/k-closest-points-to-origin/) ## Recommended practice questions _These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._ - [Top K Frequent Elements](https://leetcode.com/problems/top-k-frequent-elements/) - [Find Median from Data Stream](https://leetcode.com/problems/find-median-from-data-stream/) ## Recommended courses import AlgorithmCourses from '../\_courses/AlgorithmCourses.md' ================================================ FILE: apps/website/contents/algorithms/interval.md ================================================ --- id: interval title: Interval cheatsheet for coding interviews description: Interval study guide for coding interviews, including practice questions, techniques, time complexity, and recommended resources keywords: [ interval coding interview study guide, interval tips for coding interviews, interval practice questions, interval useful techniques, interval time complexity, interval recommended study resources, ] sidebar_label: Interval toc_max_heading_level: 2 --- ## Introduction Interval questions are a subset of [array](./array.md) questions where you are given an array of two-element arrays (an interval) and the two values represent a start and an end value. Interval questions are considered part of the array family but they involve some common techniques hence they are extracted out to this special section of their own. An example interval array: `[[1, 2], [4, 7]]`. Interval questions can be tricky to those who have not tried them before because of the sheer number of cases to consider when they overlap. ## Things to look out for during interviews - Clarify with the interviewer whether `[1, 2]` and `[2, 3]` are considered overlapping intervals as it affects how you will write your equality checks. - Clarify whether an interval of `[a, b]` will strictly follow `a` < `b` (`a` is smaller than `b`) ## Corner cases - No intervals - Single interval - Two intervals - Non-overlapping intervals - An interval totally consumed within another interval - Duplicate intervals (exactly the same start and end) - Intervals which start right where another interval ends - `[[1, 2], [2, 3]]` ## Techniques ### Sort the array of intervals by its starting point A common routine for interval questions is to sort the array of intervals by each interval's starting value. This step is crucial to solving the [Merge Intervals](https://leetcode.com/problems/merge-intervals/) question. ### Checking if two intervals overlap Be familiar with writing code to check if two intervals overlap. ```py def is_overlap(a, b): return a[0] < b[1] and b[0] < a[1] ``` ### Merging two intervals ```py def merge_overlapping_intervals(a, b): return [min(a[0], b[0]), max(a[1], b[1])] ``` ## Essential questions _These are essential questions to practice if you're studying for this topic._ - [Merge Intervals](https://leetcode.com/problems/merge-intervals/) - [Insert Interval](https://leetcode.com/problems/insert-interval/) ## Recommended practice questions _These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._ - [Non-overlapping Intervals](https://leetcode.com/problems/non-overlapping-intervals/) - [Meeting Rooms (LeetCode Premium)](https://leetcode.com/problems/meeting-rooms/) - [Meeting Rooms II (LeetCode Premium)](https://leetcode.com/problems/meeting-rooms-ii/) ## Recommended courses import AlgorithmCourses from '../\_courses/AlgorithmCourses.md' ================================================ FILE: apps/website/contents/algorithms/linked-list.md ================================================ --- id: linked-list title: Linked list cheatsheet for coding interviews description: Linked list study guide for coding interviews, including practice questions, techniques, time complexity, and recommended resources keywords: [ linked list coding interview study guide, linked list tips for coding interviews, linked list practice questions, linked list useful techniques, linked list time complexity, linked list recommended study resources, ] sidebar_label: Linked list toc_max_heading_level: 2 --- ## Introduction Like arrays, a linked list is used to represent sequential data. It is a linear collection of data elements whose order is not given by their physical placement in memory, as opposed to arrays, where data is stored in sequential blocks of memory. Instead, each element contains an address of the next element. It is a data structure consisting of a collection of nodes which together represent a sequence. In its most basic form, each node contains: data, and a reference (in other words, a link) to the next node in the sequence. **Advantages** Insertion and deletion of a node in the list (given its location) is O(1) whereas in arrays the following elements will have to be shifted. **Disadvantages** Access time is linear because directly accessing elements by its position in the list is not possible (in arrays you can do `arr[4]` for example). You have to traverse from the start. ## Learning resources - Readings - [What's a Linked List, Anyway? [Part 1]](https://medium.com/basecs/whats-a-linked-list-anyway-part-1-d8b7e6508b9d), basecs - [What's a Linked List, Anyway? [Part 2]](https://medium.com/basecs/whats-a-linked-list-anyway-part-2-131d96f71996), basecs - Videos - [Singly-linked lists](https://www.coursera.org/lecture/data-structures/singly-linked-lists-kHhgK), University of California San Diego - [Doubly linked lists](https://www.coursera.org/lecture/data-structures/doubly-linked-lists-jpGKD), University of California San Diego ## Types of linked lists ### Singly linked list A linked list where each node points to the next node and the last node points to `null`. ### Doubly linked list A linked list where each node has two pointers, `next` which points to the next node and `prev` which points to the previous node. The `prev` pointer of the first node and the `next` pointer of the last node point to `null`. ### Circular linked list A singly linked list where the last node points back to the first node. There is a circular doubly linked list variant where the `prev` pointer of the first node points to the last node and the `next` pointer of the last node points to the first node. ## Implementations Out of the common languages, only Java provides a linked list implementation. Thankfully it's easy to write your own linked list regardless of language. | Language | API | | --- | --- | | C++ | [`std::list`](https://en.cppreference.com/w/cpp/container/list) | | Java | [`java.util.LinkedList`](https://docs.oracle.com/javase/10/docs/api/java/util/LinkedList.html) | | Python | N/A | | JavaScript | N/A | ## Time complexity | Operation | Big-O | Note | | --------- | ----- | ---------------------------------------------------- | | Access | O(n) | | | Search | O(n) | | | Insert | O(1) | Assumes you have traversed to the insertion position | | Remove | O(1) | Assumes you have traversed to the node to be removed | ## Common routines Be familiar with the following routines because many linked list questions make use of one or more of these routines in the solution: - Counting the number of nodes in the linked list - Reversing a linked list in-place - Finding the middle node of the linked list using two pointers (fast/slow) - Merging two linked lists together ## Corner cases - Empty linked list (head is `null`) - Single node - Two nodes - Linked list has cycles. **Tip:** Clarify beforehand with the interviewer whether there can be a cycle in the list. Usually the answer is no and you don't have to handle it in the code ## Techniques ### Sentinel/dummy nodes Adding a sentinel/dummy node at the head and/or tail might help to handle many edge cases where operations have to be performed at the head or the tail. The presence of dummy nodes essentially ensures that operations will never be done on the head or the tail, thereby removing a lot of headache in writing conditional checks to dealing with null pointers. Be sure to remember to remove them at the end of the operation. ### Two pointers Two pointer approaches are also common for linked lists. This approach is used for many classic linked list problems. - Getting the kth from last node - Have two pointers, where one is k nodes ahead of the other. When the node ahead reaches the end, the other node is k nodes behind - Detecting cycles - Have two pointers, where one pointer increments twice as much as the other, if the two pointers meet, means that there is a cycle - Getting the middle node - Have two pointers, where one pointer increments twice as much as the other. When the faster node reaches the end of the list, the slower node will be at the middle ### Using space Many linked list problems can be easily solved by creating a new linked list and adding nodes to the new linked list with the final result. However, this takes up extra space and makes the question much less challenging. The interviewer will usually request that you modify the linked list in-place and solve the problem without additional storage. You can borrow ideas from the [Reverse a Linked List](https://leetcode.com/problems/reverse-linked-list/) problem. ### Elegant modification operations As mentioned earlier, a linked list's non-sequential nature of memory allows for efficient modification of its contents. Unlike arrays where you can only modify the value at a position, for linked lists you can also modify the `next` pointer in addition to the `value`. Here are some common operations and how they can be achieved easily: - Truncate a list - Set the `next` pointer to `null` at the last element - Swapping values of nodes - Just like arrays, just swap the value of the two nodes, there's no need to swap the `next` pointer - Combining two lists - attach the head of the second list to the tail of the first list ## Essential questions _These are essential questions to practice if you're studying for this topic._ - [Reverse a Linked List](https://leetcode.com/problems/reverse-linked-list/) - [Detect Cycle in a Linked List](https://leetcode.com/problems/linked-list-cycle/) ## Recommended practice questions _These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._ - [Merge Two Sorted Lists](https://leetcode.com/problems/merge-two-sorted-lists/) - [Merge K Sorted Lists](https://leetcode.com/problems/merge-k-sorted-lists/) - [Remove Nth Node From End Of List](https://leetcode.com/problems/remove-nth-node-from-end-of-list/) - [Reorder List](https://leetcode.com/problems/reorder-list/) ## Recommended courses import AlgorithmCourses from '../\_courses/AlgorithmCourses.md' ================================================ FILE: apps/website/contents/algorithms/math.md ================================================ --- id: math title: Math cheatsheet for coding interviews description: Math study guide for coding interviews, including practice questions, techniques, time complexity, and recommended resources keywords: [ math coding interview study guide, math tips for coding interviews, math practice questions, math useful techniques, math time complexity, math recommended study resources, ] sidebar_label: Math toc_max_heading_level: 2 --- ## Introduction Math is a foundational aspect of Computer Science and every programmer and computer scientist needs to have basic mathematical knowledge. Thankfully, for the purpose of coding interviews, there usually won't be that much math involved, but some basic math techniques is helpful to know as you may be asked to implement mathematical operations. ## Things to look out for during interviews - If code involves division or modulo, remember to check for division or modulo by 0 case. - Check for and handle overflow/underflow if you are using a typed language like Java and C++. At the very least, mention that overflow/underflow is possible and ask whether you need to handle it. - Consider negative numbers and floating point numbers. This may sound obvious, but under interview pressure, many obvious cases go unnoticed. ## Corner cases - Division by 0 - Multiplication by 1 - Negative numbers - Floats ## Common formulas | | Formula | | --- | --- | | Check if a number is even | `num % 2 == 0` | | Sum of 1 to N | 1 + 2 + ... + (N - 1) + N = (N+1) \* N/2 | | Sum of Geometric Progression | 20 + 21 + 22 + 23 + ... 2n = 2n+1 - 1 | | Permutations of N | N! / (N-K)! | | Combinations of N | N! / (K! \* (N-K)!) | ## Techniques ### Multiples of a number When a question involves "whether a number is a multiple of X", the modulo operator would be useful. ### Comparing floats When dealing with floating point numbers, take note of rounding mistakes. Consider using epsilon comparisons instead of equality checks. E.g. `abs(x - y) <= 1e-6` instead of `x == y`. ### Fast operators If the question asks you to implement an operator such as power, square root or division and want it to be faster than O(n), some sort of doubling (fast exponentiation) or halving (binary search) is usually the approach to go. Examples: [Pow(x, n)](https://leetcode.com/problems/powx-n/), [Sqrt(x)](https://leetcode.com/problems/sqrtx/) ## Essential questions _These are essential questions to practice if you're studying for this topic._ - [Pow(x, n)](https://leetcode.com/problems/powx-n/) - [Sqrt(x)](https://leetcode.com/problems/sqrtx/) ## Recommended practice questions _These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._ - [Integer to English Words](https://leetcode.com/problems/integer-to-english-words/) ## Recommended courses import AlgorithmCourses from '../\_courses/AlgorithmCourses.md' ================================================ FILE: apps/website/contents/algorithms/matrix.md ================================================ --- id: matrix title: Matrix cheatsheet for coding interviews description: Matrix study guide for coding interviews, including practice questions, techniques, time complexity, and recommended resources keywords: [ matrix coding interview study guide, matrix tips for coding interviews, matrix practice questions, matrix useful techniques, matrix time complexity, matrix recommended study resources, ] sidebar_label: Matrix toc_max_heading_level: 2 --- ## Introduction A matrix is a 2-dimensional array. Questions involving matrices are usually related to [dynamic programming](./dynamic-programming.md) or [graph](./graph.md) traversal. Matrices can be used to represent graphs where each node is a cell on the matrix which has 4 neighbors (except those cells on the edge and corners). This page will focus on questions which don't use matrix as graphs. Questions which are meant to use the matrix as a graph can be found on the [graph section](./graph.md). ## Corner cases - Empty matrix. Check that none of the arrays are 0 length - 1 x 1 matrix - Matrix with only one row or column ## Techniques ### Creating an empty N x M matrix For questions involving traversal or dynamic programming, you almost always want to make a copy of the matrix with the same size/dimensions that is initialized to empty values to store the visited state or dynamic programming table. Be familiar with such a routine in your language of choice: This can be done easily in Python in one line. ```py # Assumes that the matrix is non-empty zero_matrix = [[0 for _ in range(len(matrix[0]))] for _ in range(len(matrix))] ``` Copying a matrix in Python is: ```py copied_matrix = [row[:] for row in matrix] ``` ### Transposing a matrix The transpose of a matrix is found by interchanging its rows into columns or columns into rows. Many grid-based games can be modeled as a matrix, such as Tic-Tac-Toe, Sudoku, Crossword, Connect 4, Battleship, etc. It is not uncommon to be asked to verify the winning condition of the game. For games like Tic-Tac-Toe, Connect 4 and Crosswords, where verification has to be done vertically and horizontally, one trick is to write code to verify the matrix for the horizontal cells, transpose the matrix, and reuse the logic for horizontal verification to verify originally vertical cells (which are now horizontal). Transposing a matrix in Python is simply: ```py transposed_matrix = [[matrix[i][j] for i in range(len(matrix))] for j in range(len(matrix[0]))] ``` ## Essential questions _These are essential questions to practice if you're studying for this topic._ - [Set Matrix Zeroes](https://leetcode.com/problems/set-matrix-zeroes/) - [Spiral Matrix](https://leetcode.com/problems/spiral-matrix/) ## Recommended practice questions _These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._ - [Rotate Image](https://leetcode.com/problems/rotate-image/) - [Valid Sudoku](https://leetcode.com/problems/valid-sudoku/) ## Recommended courses import AlgorithmCourses from '../\_courses/AlgorithmCourses.md' ================================================ FILE: apps/website/contents/algorithms/oop.md ================================================ --- id: oop title: Object-oriented programming toc_max_heading_level: 2 --- ## Sample questions - How would you design a chess game? What classes and objects would you use? What methods would they have? - How would you design the data structures for a book keeping system for a library? - Explain how you would design a HTTP server? Give examples of classes, methods, and interfaces. What are the challenges here? - Discuss algorithms and data structures for a garbage collector? - How would you implement an HR system to keep track of employee salaries and benefits? - How would you implement an Elevator system? - How would you implement a Parking Lot system? ## Recommended courses - [Grokking the Object Oriented Design Interview](https://www.designgurus.io/course/grokking-the-object-oriented-design-interview?aff=kJSIoU) ================================================ FILE: apps/website/contents/algorithms/queue.md ================================================ --- id: queue title: Queue cheatsheet for coding interviews description: Queue study guide for coding interviews, including practice questions, techniques, time complexity, and recommended resources keywords: [ queue coding interview study guide, queue tips for coding interviews, queue practice questions, queue useful techniques, queue time complexity, queue recommended study resources, ] sidebar_label: Queue toc_max_heading_level: 2 --- ## Introduction A queue is a linear collection of elements that are maintained in a sequence and can be modified by the addition of elements at one end of the sequence (**enqueue** operation) and the removal of elements from the other end (**dequeue** operation). Usually, the end of the sequence at which elements are added is called the back, tail, or rear of the queue, and the end at which elements are removed is called the head or front of the queue. As an abstract data type, queues can be implemented using arrays or singly linked lists. This behavior is commonly called FIFO (first in, first out). The name "queue" for this type of structure comes from the analogy to people lining up in real life to wait for goods or services. Breadth-first search is commonly implemented using queues. ## Learning resources - Readings - [To Queue Or Not To Queue](https://medium.com/basecs/to-queue-or-not-to-queue-2653bcde5b04), basecs - Videos - [Queues](https://www.coursera.org/lecture/data-structures/queues-EShpq), University of California San Diego ## Implementations | Language | API | | --- | --- | | C++ | [`std::queue`](https://learn.microsoft.com/en-us/cpp/standard-library/queue-class?view=msvc-170) | | Java | [`java.util.Queue`](https://docs.oracle.com/javase/10/docs/api/java/util/Queue.html).Use [`java.util.ArrayDeque`](https://docs.oracle.com/javase/10/docs/api/java/util/ArrayDeque.html) | | Python | [`deque`](https://docs.python.org/3/library/collections.html#collections.deque) | | JavaScript | N/A | ## Time complexity | Operation | Big-O | | ------------- | ----- | | Enqueue/Offer | O(1) | | Dequeue/Poll | O(1) | | Front | O(1) | | Back | O(1) | | isEmpty | O(1) | ## Things to look out for during interviews Most languages don't have a built-in Queue class which can be used, and candidates often use arrays (JavaScript) or lists (Python) as a queue. However, note that the dequeue operation (assuming the front of the queue is on the left) in such a scenario will be O(n) because it requires shifting of all other elements left by one. In such cases, you can flag this to the interviewer and say that you assume that there's a queue data structure to use which has an efficient dequeue operation. ## Corner cases - Empty queue - Queue with one item - Queue with two items ## Essential questions _These are essential questions to practice if you're studying for this topic._ - [Implement Stack using Queues](https://leetcode.com/problems/implement-stack-using-queues/) ## Recommended practice questions _These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._ - [Implement Queue using Stacks](https://leetcode.com/problems/implement-queue-using-stacks/) - [Design Circular Queue](https://leetcode.com/problems/design-circular-queue/) - [Design Hit Counter (LeetCode Premium)](https://leetcode.com/problems/design-hit-counter/) ## Recommended courses import AlgorithmCourses from '../\_courses/AlgorithmCourses.md' ================================================ FILE: apps/website/contents/algorithms/recursion.md ================================================ --- id: recursion title: Recursion cheatsheet for coding interviews description: Recursion study guide for coding interviews, including practice questions, techniques, time complexity, and recommended resources keywords: [ recursion coding interview study guide, recursion tips for coding interviews, recursion practice questions, recursion useful techniques, recursion time complexity, recursion recommended study resources, ] sidebar_label: Recursion toc_max_heading_level: 2 --- ## Introduction Recursion is a method of solving a computational problem where the solution depends on solutions to smaller instances of the same problem. All recursive functions contains two parts: 1. A base case (or cases) defined, which defines when the recursion is stopped - otherwise it will go on forever! 1. Breaking down the problem into smaller subproblems and invoking the recursive call One of the most common example of recursion is the Fibonacci sequence. - Base cases: `fib(0) = 0` and `fib(1) = 1` - Recurrence relation: `fib(i) = fib(i-1) + fib(i-2)` ```py def fib(n): if n <= 1: return n return fib(n - 1) + fib(n - 2) ``` Many algorithms relevant in coding interviews make heavy use of recursion - binary search, merge sort, tree traversal, depth-first search, etc. In this article, we focus on questions which use recursion but aren't part of other well known algorithms. ## Learning resources - Readings - [Recursion](https://users.cs.utah.edu/~germain/PPS/Topics/recursion.html), University of Utah - Videos - [Tail Recursion](https://www.coursera.org/lecture/programming-languages/tail-recursion-YZic1), University of Washington ## Things to look out for during interviews - Always remember to always define a base case so that your recursion will end. - Recursion is useful for permutation, because it generates all combinations and tree-based questions. You should know how to generate all permutations of a sequence as well as how to handle duplicates. - Recursion implicitly uses a stack. Hence all recursive approaches can be rewritten iteratively using a stack. Beware of cases where the recursion level goes too deep and causes a stack overflow (the default limit in Python is 1000). You may get bonus points for pointing this out to the interviewer. Recursion will never be O(1) space complexity because a stack is involved, unless there is [tail-call optimization](https://stackoverflow.com/questions/310974/what-is-tail-call-optimization) (TCO). Find out if your chosen language supports TCO. - Number of base cases - In the fibonacci example above, note that one of our recursive calls invoke `fib(n - 2)`. This indicates that you should have 2 base cases defined so that your code covers all possible invocations of the function within the input range. If your recursive function only invokes `fn(n - 1)`, then only one base case is needed ## Corner cases - `n = 0` - `n = 1` - Make sure you have enough base cases to cover all possible invocations of the recursive function ## Techniques ### Memoization In some cases, you may be computing the result for previously computed inputs. Let's look at the Fibonacci example again. `fib(5)` calls `fib(4)` and `fib(3)`, and `fib(4)` calls `fib(3)` and `fib(2)`. `fib(3)` is being called twice! If the value for `fib(3)` is memoized and used again, that greatly improves the efficiency of the algorithm and the time complexity becomes O(n). ## Essential questions _These are essential questions to practice if you're studying for this topic._ - [Generate Parentheses](https://leetcode.com/problems/generate-parentheses/) - [Combinations](https://leetcode.com/problems/combinations/) - [Subsets](https://leetcode.com/problems/subsets/) ## Recommended practice questions _These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._ - [Letter Combinations of a Phone Number](https://leetcode.com/problems/letter-combinations-of-a-phone-number/) - [Subsets II](https://leetcode.com/problems/subsets-ii/) - [Permutations](https://leetcode.com/problems/permutations/) - [Sudoku Solver](https://leetcode.com/problems/sudoku-solver/) - [Strobogrammatic Number II (LeetCode Premium)](https://leetcode.com/problems/strobogrammatic-number-ii/) ## Recommended courses import AlgorithmCourses from '../\_courses/AlgorithmCourses.md' ================================================ FILE: apps/website/contents/algorithms/sorting-searching.md ================================================ --- id: sorting-searching title: Sorting and searching cheatsheet for coding interviews description: Sorting and searching study guide for coding interviews, including practice questions, techniques, time complexity, and recommended resources keywords: [ sorting searching coding interview study guide, sorting searching tips for coding interviews, sorting searching practice questions, sorting searching useful techniques, sorting searching time complexity, sorting searching recommended study resources, ] sidebar_label: Sorting and searching toc_max_heading_level: 2 --- ## Introduction Sorting is the act of rearranging elements in a sequence in order, either in numerical or lexicographical order, and either ascending or descending. A number of basic algorithms run in O(n2) and should not be used in interviews. In algorithm interviews, you're unlikely to need to implement any of the sorting algorithms from scratch. Instead you would need to sort the input using your language's default sorting function so that you can use binary searches on them. On a sorted array of elements, by leveraging on its sorted property, searching can be done on them in faster than O(n) time by using a binary search. Binary search compares the target value with the middle element of the array, which informs the algorithm whether the target value lies in the left half or the right half, and this comparison proceeds on the remaining half until the target is found or the remaining half is empty. ## Learning resources While you're unlikely to be asked to implement a sorting algorithm from scratch during an interview, it is good to know the various time complexities of the different sorting algorithms. - Readings - [Sorting Out The Basics Behind Sorting Algorithms](https://medium.com/basecs/sorting-out-the-basics-behind-sorting-algorithms-b0a032873add), basecs - [Binary Search](https://www.khanacademy.org/computing/computer-science/algorithms/binary-search/a/binary-search), Khan Academy - Additional (only if you have time) - [Exponentially Easy Selection Sort](https://medium.com/basecs/exponentially-easy-selection-sort-d7a34292b049), basecs - [Bubbling Up With Bubble Sorts](https://medium.com/basecs/bubbling-up-with-bubble-sorts-3df5ac88e592), basecs - [Inching Towards Insertion Sort](https://medium.com/basecs/inching-towards-insertion-sort-9799274430da), basecs - [Making Sense of Merge Sort (Part 1)](https://medium.com/basecs/making-sense-of-merge-sort-part-1-49649a143478), basecs - [Making Sense of Merge Sort (Part 2)](https://medium.com/basecs/making-sense-of-merge-sort-part-2-be8706453209), basecs - [Pivoting To Understand Quicksort (Part 1)](https://medium.com/basecs/pivoting-to-understand-quicksort-part-1-75178dfb9313), basecs - [Pivoting To Understand Quicksort (Part 2)](https://medium.com/basecs/pivoting-to-understand-quicksort-part-2-30161aefe1d3), basecs - [Counting Linearly With Counting Sort](https://medium.com/basecs/counting-linearly-with-counting-sort-cd8516ae09b3), basecs - [Getting To The Root Of Sorting With Radix Sort](https://medium.com/basecs/getting-to-the-root-of-sorting-with-radix-sort-f8e9240d4224), basecs - Videos - [Heapsort](https://www.youtube.com/watch?v=ryRfapIQHW0&feature=youtu.be) ([slides](https://samuelalbanie.com/files/digest-slides/2022-12-brief-guide-to-heapsort-and-binary-heaps.pdf)), Samuel Albanie, University of Cambridge - [Quicksort](https://www.youtube.com/watch?v=kbiKn1K08RM&feature=youtu.be) ([slides](https://samuelalbanie.com/files/digest-slides/2023-01-brief-guide-to-quicksort.pdf)), Samuel Albanie, University of Cambridge - [Lower bounds for comparison sorts](https://www.youtube.com/watch?v=JWSiXs9aB5U) ([slides](https://samuelalbanie.com/files/digest-slides/2023-01-brief-guide-to-comparison-sorting-lower-bounds.pdf)), Samuel Albanie, University of Cambridge - [Counting sort](https://www.youtube.com/watch?v=0aMcZpAySjw) ([slides](https://samuelalbanie.com/files/digest-slides/2023-01-brief-guide-to-counting-sort.pdf)), Samuel Albanie, University of Cambridge - [Radix sort](https://www.youtube.com/watch?v=HzPbzQi9404) ([slides](https://samuelalbanie.com/files/digest-slides/2023-01-brief-guide-to-radix-sort.pdf)), Samuel Albanie, University of Cambridge - [Bucket sort](https://www.youtube.com/watch?v=mz2fBJyoEVc) ([slides](https://samuelalbanie.com/files/digest-slides/2023-01-brief-guide-to-bucket-sort.pdf)), Samuel Albanie, University of Cambridge ## Time complexity | Algorithm | Time | Space | | -------------- | ---------------- | --------- | | Bubble sort | O(n2) | O(1) | | Insertion sort | O(n2) | O(1) | | Selection sort | O(n2) | O(1) | | Quicksort | O(nlog(n)) | O(log(n)) | | Mergesort | O(nlog(n)) | O(n) | | Heapsort | O(nlog(n)) | O(1) | | Counting sort | O(n + k) | O(k) | | Radix sort | O(nk) | O(n + k) | | Algorithm | Big-O | | ------------- | --------- | | Binary search | O(log(n)) | ## Things to look out for during interviews Make sure you know the time and space complexity of the language's default sorting algorithm! The time complexity is almost definitely O(n log n). Bonus points if you can name the sort. In Python 3.11+, it's [Powersort](https://www.wild-inter.net/posts/powersort-in-python-3.11), which replaced Timsort as the default sorting algorithm. In Java, [an implementation of Timsort](https://github.com/openjdk/jdk/blob/d9052b946682d1c0f2629455d73fe4e6b95b29db/src/java.base/share/classes/java/util/TimSort.java) is used for sorting objects, and [Dual-Pivot Quicksort](https://github.com/openjdk/jdk/blob/d9052b946682d1c0f2629455d73fe4e6b95b29db/src/java.base/share/classes/java/util/DualPivotQuicksort.java) is used for sorting primitives. ## Corner cases - Empty sequence - Sequence with one element - Sequence with two elements - Sequence containing duplicate elements. ## Techniques ### Sorted inputs When a given sequence is in a sorted order (be it ascending or descending), using binary search should be one of the first things that come to your mind. ### Sorting an input that has limited range [Counting sort](https://en.wikipedia.org/wiki/Counting_sort) is a non-comparison-based sort you can use on numbers where you know the range of values beforehand. Examples: [H-Index](https://leetcode.com/problems/h-index/) ## Essential questions _These are essential questions to practice if you're studying for this topic._ - [Binary Search](https://leetcode.com/problems/binary-search/) - [Search in Rotated Sorted Array](https://leetcode.com/problems/search-in-rotated-sorted-array/) ## Recommended practice questions _These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._ - [Kth Smallest Element in a Sorted Matrix](https://leetcode.com/problems/kth-smallest-element-in-a-sorted-matrix/) - [Search a 2D Matrix](https://leetcode.com/problems/search-a-2d-matrix/) - [Kth Largest Element in an Array](https://leetcode.com/problems/kth-largest-element-in-an-array/) - [Find Minimum in Rotated Sorted Array](https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/) - [Median of Two Sorted Arrays](https://leetcode.com/problems/median-of-two-sorted-arrays/) ## Recommended courses import AlgorithmCourses from '../\_courses/AlgorithmCourses.md' ================================================ FILE: apps/website/contents/algorithms/stack.md ================================================ --- id: stack title: Stack cheatsheet for coding interviews description: Stack study guide for coding interviews, including practice questions, techniques, time complexity, and recommended resources keywords: [ stack coding interview study guide, stack tips for coding interviews, stack practice questions, stack useful techniques, stack time complexity, stack recommended study resources, ] sidebar_label: Stack toc_max_heading_level: 2 --- ## Introduction A stack is an abstract data type that supports the operations **push** (insert a new element on the top of the stack) and **pop** (remove and return the most recently added element, the element at the top of the stack). As an abstract data type, stacks can be implemented using arrays or singly linked lists. This behavior is commonly called LIFO (last in, first out). The name "stack" for this type of structure comes from the analogy to a set of physical items stacked on top of each other. Stacks are an important way of supporting nested or recursive function calls and is used to implement depth-first search. Depth-first search can be implemented using recursion or a manual stack. ## Learning resources - Readings - [Stacks and Overflows](https://medium.com/basecs/stacks-and-overflows-dbcf7854dc67), basecs - Videos - [Stacks](https://www.coursera.org/lecture/data-structures/stacks-UdKzQ), University of California San Diego ## Implementations | Language | API | | --- | --- | | C++ | [`std::stack`](https://learn.microsoft.com/en-us/cpp/standard-library/stack-class?view=msvc-170) | | Java | [`java.util.Stack`](https://docs.oracle.com/javase/10/docs/api/java/util/Stack.html) | | Python | Simulated using [List](https://docs.python.org/3/tutorial/datastructures.html) | | JavaScript | Simulated using [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) | ## Time complexity | Operation | Big-O | | --------- | ----- | | Top/Peek | O(1) | | Push | O(1) | | Pop | O(1) | | isEmpty | O(1) | | Search | O(n) | ## Corner cases - Empty stack. Popping from an empty stack - Stack with one item - Stack with two items ## Essential questions _These are essential questions to practice if you're studying for this topic._ - [Valid Parentheses](https://leetcode.com/problems/valid-parentheses/) - [Implement Queue using Stacks](https://leetcode.com/problems/implement-queue-using-stacks/) ## Recommended practice questions _These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._ - [Implement Stack using Queues](https://leetcode.com/problems/implement-stack-using-queues/) - [Min Stack](https://leetcode.com/problems/min-stack/) - [Asteroid Collision](https://leetcode.com/problems/asteroid-collision/) - [Evaluate Reverse Polish Notation](https://leetcode.com/problems/evaluate-reverse-polish-notation/) - [Basic Calculator](https://leetcode.com/problems/basic-calculator/) - [Basic Calculator II](https://leetcode.com/problems/basic-calculator-ii/) - [Daily Temperatures](https://leetcode.com/problems/daily-temperatures/) - [Trapping Rain Water](https://leetcode.com/problems/trapping-rain-water/) - [Largest Rectangle in Histogram](https://leetcode.com/problems/largest-rectangle-in-histogram/) ## Recommended courses import AlgorithmCourses from '../\_courses/AlgorithmCourses.md' ================================================ FILE: apps/website/contents/algorithms/string.md ================================================ --- id: string title: String cheatsheet for coding interviews description: String study guide for coding interviews, including practice questions, techniques, time complexity, and recommended resources keywords: [ string coding interview study guide, string tips for coding interviews, string practice questions, string useful techniques, string time complexity, string recommended study resources, ] sidebar_label: String toc_max_heading_level: 2 --- ## Introduction A string is a sequence of characters. Many tips that apply to arrays also apply to strings. You're recommended to read the page on [Arrays](./array.md) before reading this page. Common data structures for looking up strings: - [Trie/Prefix Tree](https://en.wikipedia.org/wiki/Trie) - [Suffix Tree](https://en.wikipedia.org/wiki/Suffix_tree) Common string algorithms: - [Rabin Karp](https://en.wikipedia.org/wiki/Rabin%E2%80%93Karp_algorithm) for efficient searching of substring using a rolling hash - [KMP](https://en.wikipedia.org/wiki/Knuth%E2%80%93Morris%E2%80%93Pratt_algorithm) for efficient searching of substring ## Time complexity A strings is an array of characters, so the time complexities of basic string operations will closely resemble that of array operations. | Operation | Big-O | | --------- | ----- | | Access | O(1) | | Search | O(n) | | Insert | O(n) | | Remove | O(n) | ### Operations involving another string Here we assume the other string is of length m. | Operation | Big-O | Note | | --- | --- | --- | | Find substring | O(n.m) | This is the most naive case. There are more efficient algorithms for string searching such as the [KMP algorithm](https://en.wikipedia.org/wiki/Knuth%E2%80%93Morris%E2%80%93Pratt_algorithm) | | Concatenating strings | O(n + m) | | | Slice | O(m) | | | Split (by token) | O(n + m) | | | Strip (remove leading and trailing whitespaces) | O(n) | | ## Things to look out for during interviews Ask about input character set and case sensitivity. Usually the characters are limited to lowercase Latin characters, for example a to z. ## Corner cases - Empty string - String with 1 or 2 characters - String with repeated characters - Strings with only distinct characters ## Techniques Many string questions fall into one of these buckets. ### Counting characters Often you will need to count the frequency of characters in a string. The most common way of doing that is by using a hash table/map in your language of choice. If your language has a built-in Counter class like Python, ask if you can use that instead. If you need to keep a counter of characters, a common mistake is to say that the space complexity required for the counter is O(n). The space required for a counter of a string of latin characters is O(1) not O(n). This is because the upper bound is the range of characters, which is usually a fixed constant of 26. The input set is just lowercase Latin characters. #### String of unique characters A neat trick to count the characters in a string of unique characters is to use a 26-bit bitmask to indicate which lower case latin characters are inside the string. ```py mask = 0 for c in word: mask |= (1 << (ord(c) - ord('a'))) ``` To determine if two strings have common characters, perform `&` on the two bitmasks. If the result is non-zero, ie. `mask_a & mask_b > 0`, then the two strings have common characters. ### Anagram An anagram is word switch or word play. It is the result of rearranging the letters of a word or phrase to produce a new word or phrase, while using all the original letters only once. In interviews, usually we are only bothered with words without spaces in them. To determine if two strings are anagrams, there are a few approaches: - Sorting both strings should produce the same resulting string. This takes O(n.log(n)) time and O(n) space. - If we map each character to a prime number and we multiply each mapped number together, anagrams should have the same multiple (prime factor decomposition). This takes O(n) time and O(1) space. Examples: [Group Anagram](https://leetcode.com/problems/group-anagrams/) - Frequency counting of characters will help to determine if two strings are anagrams. This also takes O(n) time and O(1) space. ### Palindrome A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward as forward, such as `madam` or `racecar`. Here are ways to determine if a string is a palindrome: - Reverse the string and it should be equal to itself. - Have two pointers at the start and end of the string. Move the pointers inward till they meet. At every point in time, the characters at both pointers should match. The order of characters within the string matters, so hash tables are usually not helpful. When a question is about counting the number of palindromes, a common trick is to have two pointers that move outward, away from the middle. Note that palindromes can be even or odd length. For each middle pivot position, you need to check it twice - once that includes the character and once without the character. This technique is used in [Longest Palindromic Substring](https://leetcode.com/problems/longest-palindromic-substring/). - For substrings, you can terminate early once there is no match - For subsequences, use dynamic programming as there are overlapping subproblems. Check out [this question](https://leetcode.com/problems/longest-palindromic-subsequence/) ## Essential questions _These are essential questions to practice if you're studying for this topic._ - [Valid Anagram](https://leetcode.com/problems/valid-anagram/) - [Valid Palindrome](https://leetcode.com/problems/valid-palindrome/) - [Longest Substring Without Repeating Characters](https://leetcode.com/problems/longest-substring-without-repeating-characters/) ## Recommended practice questions _These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._ - [Longest Repeating Character Replacement](https://leetcode.com/problems/longest-repeating-character-replacement/) - [Find All Anagrams in a String](https://leetcode.com/problems/find-all-anagrams-in-a-string/) - [Minimum Window Substring](https://leetcode.com/problems/minimum-window-substring/description/) - [Group Anagrams](https://leetcode.com/problems/group-anagrams/) - [Longest Palindromic Substring](https://leetcode.com/problems/longest-palindromic-substring/) - [Encode and Decode Strings (LeetCode Premium)](https://leetcode.com/problems/encode-and-decode-strings/) ## Recommended courses import AlgorithmCourses from '../\_courses/AlgorithmCourses.md' ================================================ FILE: apps/website/contents/algorithms/study-cheatsheet.md ================================================ --- id: study-cheatsheet title: Data structures and algorithms study cheatsheets for coding interviews description: Study guides for coding interviews with focus on data structures and algorithms, including practice questions, techniques, time complexity and recommended resources keywords: [coding interview algorithms, coding interview data structures] sidebar_label: Introduction --- import InDocAd from '../\_components/InDocAd'; ## What is this This section dives deep into practical knowledge and techniques for algorithms and data structures which appear frequently in algorithm interviews. The more techniques you have in your arsenal, the higher the chances of passing the interview. They may lead you to discover corner cases you might have missed out or even lead you towards the optimal approach! ## Contents of each study guide For each topic, you can expect to find: 1. A brief overview 1. Learning resources 1. Language-specific libraries to use 1. Time complexities cheatsheet 1. Things to look out for during interviews 1. Corner cases 1. Useful techniques with recommended questions to practice ## Study guides list Here is the list of data structures and algorithms you should prepare for coding interviews and their corresponding study guides: | Topic | Priority | | ----------------------------------------------- | -------- | | [Array](./array.md) | High | | [String](./string.md) | High | | [Hash Table](./hash-table.md) | Mid | | [Recursion](./recursion.md) | Mid | | [Sorting and searching](./sorting-searching.md) | High | | [Matrix](./matrix.md) | High | | [Linked List](./linked-list.md) | Mid | | [Queue](./queue.md) | Mid | | [Stack](./stack.md) | Mid | | [Tree](./tree.md) | High | | [Graph](./graph.md) | High | | [Heap](./heap.md) | Mid | | [Trie](./trie.md) | Mid | | [Interval](./interval.md) | Mid | | [Dynamic programming](./dynamic-programming.md) | Low | | [Binary](./binary.md) | Low | | [Math](./math.md) | Low | | [Geometry](./geometry.md) | Low | ## General interview tips Clarify any assumptions you made subconsciously. Many questions are under-specified on purpose. Always validate input first. Check for invalid/empty/negative/different type input. Never assume you are given the valid parameters. Alternatively, clarify with the interviewer whether you can assume valid input (usually yes), which can save you time from writing code that does input validation. Are there any time/space complexity requirements/constraints? Check for off-by-one errors. In languages where there are no automatic type coercion, check that concatenation of values are of the same type: `int`/`str`/`list`. After finishing your code, use a few example inputs to test your solution. Is the algorithm meant to be run multiple times, for example in a web server? If yes, the input is likely to be preprocess-able to improve the efficiency in each call. Use a mix of functional and imperative programming paradigms: - Write pure functions as much as possible. - Pure functions are easier to reason about and can help to reduce bugs in your implementation. - Avoid mutating the parameters passed into your function especially if they are passed by reference unless you are sure of what you are doing. - However, functional programming is usually expensive in terms of space complexity because of non-mutation and the repeated allocation of new objects. On the other hand, imperative code is faster because you operate on existing objects. Hence you will need to achieve a balance between accuracy vs efficiency, by using the right amount of functional and imperative code where appropriate. - Avoid relying on and mutating global variables. Global variables introduce state. - If you have to rely on global variables, make sure that you do not mutate it by accident. Generally, to improve the speed of a program, we can either: (1) choose a more appropriate data structure/algorithm; or (2) use more memory. The latter demonstrates a classic space vs. time tradeoff, but it is not necessarily the case that you can only achieve better speed at the expense of space. Also, note that there is often a theoretical limit to how fast your program can run (in terms of time complexity). For instance, a question that requires you to find the smallest/largest element in an unsorted array cannot run faster than O(N). Data structures are your weapons. Choosing the right weapon for the right battle is the key to victory. Be very familiar about the strengths of each data structure and the time complexities for its various operations. Data structures can be augmented to achieve efficient time complexities across different operations. For example, a hash map can be used together with a doubly-linked list to achieve O(1) time complexity for both the `get` and `put` operation in an [LRU cache](https://leetcode.com/problems/lru-cache/). Hash table is probably the most commonly used data structure for algorithm questions. If you are stuck on a question, your last resort can be to enumerate through the common possible data structures (thankfully there aren't that many of them) and consider whether each of them can be applied to the problem. This has worked for me sometimes. If you are cutting corners in your code, state that out loud to your interviewer and say what you would do in a non-interview setting (no time constraints). E.g., I would write a regex to parse this string rather than using `split()` which may not cover all cases. ## Recommended courses import AlgorithmCourses from '../\_courses/AlgorithmCourses.md' ================================================ FILE: apps/website/contents/algorithms/tree.md ================================================ --- id: tree title: Tree cheatsheet for coding interviews description: Tree study guide for coding interviews, including practice questions, techniques, time complexity, and recommended resources keywords: [ tree coding interview study guide, tree tips for coding interviews, tree practice questions, tree useful techniques, tree time complexity, tree recommended study resources, ] sidebar_label: Tree toc_max_heading_level: 2 --- ## Introduction A tree is a widely used abstract data type that represents a hierarchical structure with a set of connected nodes. Each node in the tree can be connected to many children, but must be connected to exactly one parent, except for the root node, which has no parent. A tree is an undirected and connected acyclic graph. There are no cycles or loops. Each node can be like the root node of its own subtree, making [recursion](recursion.md) a useful technique for tree traversal. For the purpose of interviews, you will usually be asked on binary trees as opposed to ternary (3 children) or N-ary (N children) trees. In this page,we will cover binary trees and binary search trees, which is a special case of binary trees. Trees are commonly used to represent hierarchical data, e.g. file systems, JSON, and HTML documents. Do check out the section on [Trie](trie.md), which is an advanced tree used for efficiently storing and searching strings. ## Learning resources - Videos - [Trees](https://www.coursera.org/lecture/data-structures/trees-95qda), University of California San Diego - [A Brief Guide to Binary Search Trees](https://www.youtube.com/watch?v=0woI8l0ZWmA) ([slides](https://samuelalbanie.com/files/digest-slides/2022-10-brief-guide-to-binary-search-trees.pdf)), Samuel Albanie, University of Cambridge - [A Brief Guide to Red-Black Trees](https://www.youtube.com/watch?v=t-oiZnplv7g) ([slides](https://samuelalbanie.com/files/digest-slides/2022-12-brief-guide-to-red-black-trees.pdf)), Samuel Albanie, University of Cambridge - [A Brief Guide to B-trees](https://www.youtube.com/watch?app=desktop&v=7MqaHGWRS3E) ([slides](https://samuelalbanie.com/files/digest-slides/2022-12-brief-guide-to-b-trees.pdf)), Samuel Albanie, University of Cambridge - Readings - [How To Not Be Stumped By Trees](https://medium.com/basecs/how-to-not-be-stumped-by-trees-5f36208f68a7), basecs - [Leaf It Up To Binary Trees](https://medium.com/basecs/leaf-it-up-to-binary-trees-11001aaf746d), basecs - Additional (only if you have time) - [The Little AVL Tree That Could](https://medium.com/basecs/the-little-avl-tree-that-could-86a3cae410c7), basecs - [Busying Oneself With B-Trees](https://medium.com/basecs/busying-oneself-with-b-trees-78bbf10522e7), basecs - [Painting Nodes Black With Red-Black Trees](https://medium.com/basecs/painting-nodes-black-with-red-black-trees-60eacb2be9a5), basecs ## Common terms you need to know - **Neighbor** - Parent or child of a node - **Ancestor** - A node reachable by traversing its parent chain - **Descendant** - A node in the node's subtree - **Degree** - Number of children of a node - **Degree of a tree** - Maximum degree of nodes in the tree - **Distance** - Number of edges along the shortest path between two nodes - **Level/Depth** - Number of edges along the unique path between a node and the root node - **Width** - Number of nodes in a level ### Binary tree Binary means two, so nodes in a binary tree have a maximum of two children. **Binary tree terms** - Complete binary tree - A complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all nodes in the last level are as far left as possible. - Balanced binary tree - A binary tree structure in which the left and right subtrees of every node differ in height by no more than 1. **Traversals** ![Tree](https://upload.wikimedia.org/wikipedia/commons/5/5e/Binary_tree_v2.svg) Given such a tree, these are the results for the various traversals. - **In-order traversal** - Left -> Root -> Right - Result: 2, 7, 5, 6, 11, 1, 9, 5, 9 - **Pre-order traversal** - Root -> Left -> Right - Result: 1, 7, 2, 6, 5, 11, 9, 9, 5 - **Post-order traversal** - Left -> Right -> Root - Result: 2, 5, 11, 6, 7, 5, 9, 9, 1 Note that in-order traversal of a binary tree is insufficient to uniquely serialize a tree. Pre-order or post-order traversal is also required. ### Binary search tree (BST) In-order traversal of a BST will give you all elements in order. Be very familiar with the properties of a BST and validating that a binary tree is a BST. This comes up more often than expected. When a question involves a BST, the interviewer is usually looking for a solution which runs faster than O(n). #### Time complexity | Operation | Big-O | | --------- | --------- | | Access | O(log(n)) | | Search | O(log(n)) | | Insert | O(log(n)) | | Remove | O(log(n)) | Space complexity of traversing balanced trees is O(h) where h is the height of the tree, while traversing very skewed trees (which is essentially a linked list) will be O(n). ## Things to look out for during interviews You should be very familiar with writing pre-order, in-order, and post-order traversal recursively. As an extension, challenge yourself by writing them iteratively. Sometimes interviewers ask candidates for the iterative approach, especially if the candidate finishes writing the recursive approach too quickly. ## Corner cases - Empty tree - Single node - Two nodes - Very skewed tree (like a linked list) ## Common routines Be familiar with the following routines because many tree questions make use of one or more of these routines in the solution: - Insert value - Delete value - Count number of nodes in tree - Whether a value is in the tree - Calculate height of the tree - Binary search tree - Determine if it is a binary search tree - Get maximum value - Get minimum value ## Techniques ### Use recursion Recursion is the most common approach for traversing trees. When you notice that the subtree problem can be used to solve the entire problem, try using recursion. When using recursion, always remember to check for the base case, usually where the node is `null`. Sometimes it is possible that your recursive function needs to return two values. ### Traversing by level When you are asked to traverse a tree by level, use breadth-first search. ### Summation of nodes If the question involves summation of nodes along the way, be sure to check whether nodes can be negative. ## Essential questions _These are essential questions to practice if you're studying for this topic._ - Binary Tree - [Maximum Depth of Binary Tree](https://leetcode.com/problems/maximum-depth-of-binary-tree/) - [Invert/Flip Binary Tree](https://leetcode.com/problems/invert-binary-tree/) - Binary Search Tree - [Lowest Common Ancestor of a Binary Search Tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/) ## Recommended practice questions _These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._ - Binary tree - [Same Tree](https://leetcode.com/problems/same-tree/) - [Binary Tree Maximum Path Sum](https://leetcode.com/problems/binary-tree-maximum-path-sum/) - [Binary Tree Level Order Traversal](https://leetcode.com/problems/binary-tree-level-order-traversal/) - [Lowest Common Ancestor of a Binary Tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/) - [Binary Tree Right Side View](https://leetcode.com/problems/binary-tree-right-side-view/) - [Subtree of Another Tree](https://leetcode.com/problems/subtree-of-another-tree/) - [Construct Binary Tree from Preorder and Inorder Traversal](https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/) - [Serialize and Deserialize Binary Tree](https://leetcode.com/problems/serialize-and-deserialize-binary-tree/) - Binary search tree - [Validate Binary Search Tree](https://leetcode.com/problems/validate-binary-search-tree/) - [Kth Smallest Element in a BST](https://leetcode.com/problems/kth-smallest-element-in-a-bst/) ## Recommended courses import AlgorithmCourses from '../\_courses/AlgorithmCourses.md' ================================================ FILE: apps/website/contents/algorithms/trie.md ================================================ --- id: trie title: Trie cheatsheet for coding interviews description: Trie study guide for coding interviews, including practice questions, techniques, time complexity, and recommended resources keywords: [ trie coding interview study guide, trie tips for coding interviews, trie practice questions, trie useful techniques, trie time complexity, trie recommended study resources, ] sidebar_label: Trie toc_max_heading_level: 2 --- ## Introduction Tries are special trees (prefix trees) that make searching and storing strings more efficient. Tries have many practical applications, such as conducting searches and providing autocomplete. It is helpful to know these common applications so that you can easily identify when a problem can be efficiently solved using a trie. Be familiar with implementing from scratch, a `Trie` class and its `add`, `remove` and `search` methods. ## Learning resources - Readings - [Trying to Understand Tries](https://medium.com/basecs/trying-to-understand-tries-3ec6bede0014), basecs - [Implement Trie (Prefix Tree)](https://leetcode.com/problems/implement-trie-prefix-tree/editorial/), LeetCode - Additional (only if you have time) - [Compressing Radix Trees Without (Too Many) Tears](https://medium.com/basecs/compressing-radix-trees-without-too-many-tears-a2e658adb9a0), basecs ## Time complexity `m` is the length of the string used in the operation. | Operation | Big-O | | --------- | ----- | | Search | O(m) | | Insert | O(m) | | Remove | O(m) | ## Corner cases - Searching for a string in an empty trie - Inserting empty strings into a trie ## Techniques Sometimes preprocessing a dictionary of words (given in a list) into a trie, will improve the efficiency of searching for a word of length k, among n words. Searching becomes O(k) instead of O(n). ## Essential questions _These are essential questions to practice if you're studying for this topic._ - [Implement Trie (Prefix Tree)](https://leetcode.com/problems/implement-trie-prefix-tree/) ## Recommended practice questions _These are recommended questions to practice after you have studied for the topic and have practiced the essential questions._ - [Add and Search Word](https://leetcode.com/problems/design-add-and-search-words-data-structure/) - [Word Break](https://leetcode.com/problems/word-break/) - [Word Search II](https://leetcode.com/problems/word-search-ii/) ## Recommended courses import AlgorithmCourses from '../\_courses/AlgorithmCourses.md' ================================================ FILE: apps/website/contents/behavioral-interview-questions.md ================================================ --- id: behavioral-interview-questions title: The 30 most common Software Engineer behavioral interview questions description: How to prepare for Software Engineer behavioral interviews keywords: [ software engineer behavioral interview questions, software engineering behavioral questions, software developer behavioral interview questions, software engineer behavioral questions, amazon software engineer behavioral interview questions, behavioral interview software engineer, how to prepare for behavioral interview software engineer, ] sidebar_label: Common behavioral questions to practice --- import InDocAd from './\_components/InDocAd'; In the software engineer interview process, behavioral interviews may seem so much more varied and unstructured as compared to technical interviews. However, in most cases, the interviewer is actually just trying to get to know you better and there's always a set of common questions that need to be asked to achieve that. ## Most commonly asked behavioral questions across top tech companies Here are some of the 30 most commonly asked behavioral interview questions across top tech companies: 1. Why do you want to work for X company? 1. Why do you want to leave your current/last company? 1. What are you looking for in your next role? 1. Tell me about a time when you had a conflict with a co-worker. 1. Tell me about a time in which you had a conflict and needed to influence somebody else. 1. What project are you currently working on? 1. What is the most challenging aspect of your current project? 1. What was the most difficult bug that you fixed in the past 6 months? 1. How do you tackle challenges? Name a difficult challenge you faced while working on a project, how you overcame it, and what you learned. 1. What are you excited about? 1. What frustrates you? 1. Imagine it is your first day here at the company. What do you want to work on? What features would you improve on? 1. What are the most interesting projects you have worked on and how might they be relevant to this company's environment? 1. Tell me about a time you had a disagreement with your manager. 1. Talk about a project you are most passionate about, or one where you did your best work. 1. What does your best day of work look like? 1. What is something that you had to push for in your previous projects? 1. What is the most constructive feedback you have received in your career? 1. What is something you had to persevere at for multiple months? 1. Tell me about a time you met a tight deadline. 1. If this were your first annual review with our company, what would I be telling you right now? 1. Time management has become a necessary factor in productivity. Give an example of a time-management skill you've learned and applied at work. 1. Tell me about a problem you've had getting along with a work associate. 1. What aspects of your work are most often criticized? 1. How have you handled criticism of your work? 1. What strengths do you think are most important for _your job position_? 1. What words would your colleagues use to describe you? 1. What would you hope to achieve in the first six months after being hired? 1. Tell me why you will be a good fit for the position. ## Airbnb Software Engineer behavioral interview questions While loving to travel or appreciating Airbnb's growth may be good answers, try to demonstrate the deep connection you have with the product. - What does "belong anywhere" mean to you? - What large problems in the world would you solve today? - Why do you like Airbnb? - If you had an unlimited budget and you could buy one gift for one person, what would you buy and who would you buy it for? - If you had an unlimited budget and you could go somewhere, where would you go? - Share one of your trips with us. - What is the most challenging project in or out of school that you have worked on in the last 6 months. - What is something that you don't want from your last internship/job? - Give me an example of when you've been a good host. - What's something you'd like to remove from the Airbnb experience? - What is something new that you can teach your interviewer in a few minutes? - Tell me about why you want to work here. - What is the best gift you have ever given or received? - Tell me about a time you were uncomfortable and how you dealt with it. - Explain a project that you worked on recently. - What do you think of Airbnb? - Tell me something about yourself and why you'd be a good fit for the position. - Name a situation where you were impressed by a company's customer service. - How did you work with senior management on large projects as well as multiple internal teams? - Tell me about a time you had to give someone terrible news. - If you were a gerbil, which gerbil would you be? - What excites you about the company? - How does Airbnb impact our guests and hosts? - What part of our mission resonates the most with you? Source: [Glassdoor](https://www.glassdoor.com/Interview/Airbnb-Interview-Questions-E391850.htm) ## Amazon Software Engineer behavioral interview questions - How do you deal with a failed deadline? - Why do you want to work for Amazon? - Tell me about a situation where you had a conflict with a teammate. - In your professional experience have you worked on something without getting approval from your manager? - Tell me a situation where you would have done something differently from what you actually did. - What is the most exceedingly bad misstep you've made at any point? - Describe what Human Resources means to you. - How would you improve Amazon's website? Source: [Glassdoor](https://www.glassdoor.com/Interview/Amazon-Interview-Questions-E6036.htm) ## ByteDance Software Engineer behavioral interview questions - What do you know about <role> and why? - Take me through a product you launched from start to end - What's the biggest achievement in your previous projects? - Tell me about a recent failure and what you learned from the experience - Why do you want to work at ByteDance? - What makes you a good fit for this position? - What excites you about the role? Source: [Glassdoor](https://www.glassdoor.sg/Interview/ByteDance-Interview-Questions-E1624196.htm) ## Dropbox Software Engineer behavioral interview questions - Talk about your favorite project. - If you were hired here what would you do? - State an experience about how you solved a technical problem. Be specific about the diagnosis and process. Source: [Glassdoor](https://www.glassdoor.com/Interview/Dropbox-Interview-Questions-E415350.htm) ## Hired Software Engineer behavioral interview questions - Tell me about yourself. - What is your biggest strength and area of growth? - Why are you interested in this opportunity? - What are your salary expectations? - Why are you looking to leave your current company? - Tell me about a time your work responsibilities got a little overwhelming. What did you do? - Give me an example of a time when you had a difference of opinion with a team member. How did you handle that? - Tell me about a challenge you faced recently in your role. How did you tackle it? What was the outcome? - Where do you want to be in five years? - Tell me about a time you needed information from someone who wasn't responsive. What did you do? Source: Glassdoor ## Lyft Software Engineer behavioral interview questions - Tell me about your most interesting/challenging project to date. - Why Lyft? What are you looking for in the next role? Source: [Glassdoor](https://www.glassdoor.com/Interview/Lyft-Interview-Questions-E700614.htm) ## Palantir Software Engineer behavioral interview questions - What is something 90% of people disagree with you about? - What is broken around you? - How do you deal with difficult coworkers? Think about specific instances where you resolved conflicts. - How did you win over the difficult employees? - Tell me about an analytical problem that you have worked on in the past. - What are your three strengths and three weaknesses? - If you were in charge of picking projects for Palantir, what problem would you try to solve? - What are some of the best and worst things about your current company? - What would your manager say about you? - Describe Palantir to your grandmother. - Teach me something you've learned. - Tell me a time when you predicted something. - If your supervisors were to rate you on a scale of 1-10, what would they rate you? - What was the most fun thing you did recently? - Tell me the story of how you became who you are today and what made you apply to Palantir. Source: [Glassdoor](https://www.glassdoor.com/Interview/Palantir-Technologies-Interview-Questions-E236375.htm) ## Slack Software Engineer behavioral interview questions - Tell me something about your internship. - Why do you want to join Slack? - Tell me about your past projects. - Explain me your toughest project and the working architecture. - Apart from technical knowledge, what did you learn during your internship? - If someone has a different viewpoint to do a project like different programming language, how would handle this situation? - What are your most interesting subjects and why? - Did you find any bugs in Slack? - What is your favorite feature and why? Source: [Glassdoor](https://www.glassdoor.com/Interview/Slack-Interview-Questions-E950758.htm) ## Stack Overflow Software Engineer behavioral interview questions - What have you built? - What is the hardest technical problem you have run into? - How did you solve it? - Where do you see yourself in 5 years? - Why do you want to work here? - How do you handle disagreements with co-workers? Source: Glassdoor ## Stripe Software Engineer behavioral interview questions - How do you stay up to date with the latest technologies? - Explain a project that you worked on recently that was difficult. - Where do you see yourself in five years? Source: [Glassdoor](https://www.glassdoor.com/Interview/Stripe-Interview-Questions-E671932.htm) ## Twitter Software Engineer behavioral interview questions - What would your previous boss say your biggest strength was? Source: [Glassdoor](https://www.glassdoor.com/Interview/Twitter-Interview-Questions-E100569.htm) ================================================ FILE: apps/website/contents/behavioral-interview-rubrics.md ================================================ --- id: behavioral-interview-rubrics title: How candidates are evaluated in behavioral interviews at top tech companies description: Detailed behavioral interview rubrics collated from big tech companies keywords: [ software engineer behavioral interview prep, software developer behavioral interview prep, behavioral interview software engineer, how to prepare for behavioral interview software engineer, google behavioral interview, facebook behavioral interview, amazon behavioral interview, microsoft behavioral interview, ] sidebar_label: Behavioral interview rubrics --- _The following page is contributed by [Lior Neu-ner](https://www.linkedin.com/in/liornn/) — former Meta engineering manager and founder of [Remote Rocketship](https://remoterocketship.com/), a job board for remote tech jobs._ ## How behavioral interviews are evaluated Unlike technical interviews, behavioral interviews have a lot more variance in terms of evaluation criteria. However, most top tech companies use their company values to evaluate candidates. Interviewers typically have to fill in a section evaluating how a candidate has displayed behaviors in line with company values. It is for this reason that you should search up a company's culture and values and ensure that you embody them within your answers. You'd also find it useful to speak with one of your connections currently working at the company you are applying for to find out more about which values are typically valued in the team. Some examples of common values evaluated are: - **Motivation** - What drives you? Ideal candidates are self-motivated, passionate about technologies and products that have a real impact. - **Ability to be Proactive** - Are you able to take initiative? Given a difficult problem, are you able to figure out how to get it done and execute on it? - **Ability to work in an unstructured environment** - How well are you able to take ownership in ambiguous situations? Or do you rely on others to be told what to do? - **Perseverance** - Are you able to push through difficult problems or blockers? - **Conflict Resolution** - How well are you able to handle and work through challenging relationships? - **Empathy** - How well are you able to see things from the perspective of others and understand your motivations? - **Growth** - How well do you understand your strengths, weaknesses and growth areas? Are you making a continued effort to grow? - **Communication** - Are you able to clearly communicate your stories during the interview? To assess these focus areas, interviewers ask questions on your work history and dig into the details of how you handled various situations. To assess your seniority, for each focus area they determine if the scope of the situation is something they would expect for a junior, senior, or staff engineer (more details on this below). ## Example questions and responses Below are questions and answers illustrating how interviewers collect signals on the candidate for each focus area. In a typical interview, they'll ask you five or six questions and dive deep into the details of each situation. Each question may provide signals on more than one focus area. ### Motivation Example Questions: - What project are you most proud of and why? - Tell me about a recent day working that was really great and/or fun. Example Responses: - Junior: A story about a project they are proud of that had an impact on their team. - Senior: A story about a project they are proud of that had a large impact on their team. - Staff: A story about a project they are proud of that had a large impact on their org. ### Ability to be proactive Example Questions: - Tell me about a time when you wanted to change something that was outside of your regular scope of work. - Tell me about a time you had to make a fast decision and live with the results. Example Responses: - Junior: A story about a change they proactively suggested and drove that had an impact on their team’s focus area. Usually only requiring the candidate themselves to work on. - Senior: A story about a change they proactively suggested and drove that had an impact on their entire team. Usually requiring three or more people to work on. - Staff: A story about a change they proactively suggested and drove that had an impact on their entire org. Usually requiring two or more teams to work on. ### Ability to work in an unstructured environment Example Questions: - How do you decide what to work on next? - Tell me about a project or task that was ambiguous or underspecified. Example Responses: - Junior: A story about an ambiguous task that the candidate took ownership of and was able to drive consensus from a few stakeholders in their team. Usually only requiring the candidate themselves to work on. - Senior: A story about an ambiguous project that the candidate took ownership of and was able to drive consensus from stakeholders in their team or org. Usually requiring three or more people to work on. - Staff: A story about an ambiguous project that the candidate took ownership of and was able to drive consensus from stakeholders in their org. Usually requiring two or more teams to work on. ### Perseverance Example Questions: - Tell me about a time when you needed to overcome external obstacles to complete a task or project. - Tell me about a time a project took longer as expected Example Responses: - Junior: A story about a task with many technical difficulties and how they overcame each blocker. - Senior: A story about a project with many technical difficulties that were blocking their team and how they overcame each blocker. - Staff: A story about a project with many technical difficulties that were blocking many teams and how they overcame each blocker. ### Conflict resolution and empathy Example Questions: - Tell me about a person or team who you found the most challenging to work with. - Tell me about a time you disagreed with a coworker. - Tell me about a situation where two teams couldn’t agree on a path forward. Example Responses: - Junior: A story about how they were able to work through a disagreement with a coworker on an implementation detail of a larger project. - Senior: A story about how they were able to work through a disagreement with a few coworkers or team leads on the direction of a larger project. - Staff: A story about how they were able to work through a disagreement with two or more teams on the direction of a large project. ### Growth Example Questions: - Describe a situation when you made a mistake, and what you learned from it. - Tell me about some constructive feedback you received from a manager or a peer. - Tell me about a skill set that you observed in a peer or mentor that you want to develop in the next six months. Example Responses: - Junior: A story about a new technology they want to learn and the progress they have made to learn it. - Senior: A story about a soft skill or technical skill they want to develop and the progress they have made to learn it. Usually a skill that will have the potential to affect the entire team. - Staff: A story about a soft skill or technical skill they want to develop and the progress they have made to learn it. Usually a skill that will have the potential to affect two or more teams. ### Communication - Generally covered during the interview as to how clearly they are explaining the stories. There is also some overlap with Empathy and how they communicate with others. ## After the interview After the interview, the interviewer will compile their feedback and give a hire/no-hire recommendation as well as the candidate’s seniority. The hire/no-hire decision is given as a spectrum, ranging from low confidence to high confidence. This is illustrated below: ![The spectrum of the no-hire to hire interviewing decision overlayed on the interviewer's confidence](/img/interview-hire-spectrum.jpg) The recommendation is compiled from the signals the interviewer collected on the eight focus areas. Typically, this looks like the following: - For junior engineers, a hire recommendation is given if they showed positive signals on nearly all of the eight focus areas. - For senior engineers, a hire recommendation is given if they showed positive signals on nearly all of the eight focus areas AND at the level we would expect for senior engineers. Otherwise, a no-hire recommendation is given. - For staff engineers, a hire recommendation is given if they showed positive signals on nearly all of the eight focus areas AND at the level we would expect for staff engineers. Otherwise, a no-hire recommendation is given at a staff level, although they may give a hire recommendation at a senior level. It’s worth mentioning that the interviewer’s decision is not final. Once all interview feedback has been collected from all interviews, the interviewers will discuss any concerns or strengths of the candidate with a "debrief committee". ================================================ FILE: apps/website/contents/behavioral-interview-senior-candidates.md ================================================ --- id: behavioral-interview-senior-candidates title: 'Behavioral interviews for senior candidates' description: How to prepare for Software Engineer behavioral interviews as a senior candidate keywords: [ software engineer behavioral interview prep, software developer behavioral interview prep, behavioral interview software engineer, how to prepare for behavioral interview software engineer, google behavioral interview, facebook behavioral interview, amazon behavioral interview, microsoft behavioral interview, senior behavioral interview, staff engineer behavioral interview, principal engineer behavioral interview, ] sidebar_label: Preparing for senior candidates --- import InDocAd from './\_components/InDocAd'; _The following page is a collaboration with [Austen McDonald](https://www.linkedin.com/in/austenmc/), former Senior Engineering Manager and Hiring Committee Chair at Meta, and author of [Mastering Behavioral Interviews](http://thebehavioral.tech/)._ As you advance in your engineering career, behavioral interviews become increasingly critical—and challenging. While junior engineers might skate by with weak behavioral performance if their coding is strong, senior roles (Staff+ and above) hinge on these conversations. You're being evaluated for your ability to drive organizational impact, navigate complexity, and lead others. The stakes are higher too. Senior hiring mistakes cascade across teams, making interviewers naturally more cautious. A Staff Engineer who can't resolve cross-team conflicts or a Principal who struggles with ambiguous technical decisions can derail entire initiatives. Here are some key ways to approach and improve your behavioral interviews as a senior candidate. ## Common Pitfalls in Senior Behaviorals While senior candidates face many of the same challenges as other candidates, they encounter unique pitfalls that can undermine their interviews. These stem from both higher expectations and the complexity of leadership work itself. **Lack of structure leading to incomplete signal coverage:** Unlike junior candidates who might be prodded through their stories by the interviewer, senior candidates are expected to proactively demonstrate their scope. The problem compounds when interviewers interrupt or dive into rabbit holes, as they often do at this level. As a senior candidate, you need to guide the conversation toward the most relevant signal—which means knowing what that signal is in advance. See Story Organization below. **Neglecting the full spectrum of leadership:** Senior roles require influence across multiple dimensions, but candidates often tell stories from only one perspective. I frequently hear stories focused purely on technical decisions or product outcomes, missing the equally important people leadership; risk, capacity, and change management; strategy work; and stakeholder management aspects. See Choosing Projects below. **Communicating actions, leaving out frameworks:** Senior candidates should demonstrate systematic thinking, including the decision-making framework that led to those actions. Simply listing individual actions makes you sound like an executor rather than a strategic thinker and opens you up to misinterpretation. **Verbosity:** Communication is central to these roles, so talking too much is an easy habit to fall into. There’s a lot to cover in limited time and you need to adapt to the signal requested by the interviewer and provide only the most relevant context. See [this post](https://thebehavioral.substack.com/p/avoiding-too-much-detail-in-behavioral) for more. **Opening yourself to uncharitable interpretations:** Senior candidates face higher scrutiny, which means stories, or even individual actions, that might be acceptable for more junior candidates can raise red flags when told by someone at a senior level. This requires thinking defensively about how your stories might be interpreted. See the Thinking Defensively section below. ## Story Selection: Beyond Pure Technical Impact At the senior level, your project stories need to demonstrate multifaceted leadership that spans the full spectrum of modern engineering work. **Choose projects with leadership complexity:** Look for initiatives that involved multiple teams, ambiguous requirements, and/or significant technical risk. **Demonstrate the full leadership spectrum:** Your stories should include evidence across four key dimensions: - **Technical leadership:** Architecture decisions, technology choices, technical debt management - **People leadership:** Mentoring, conflict resolution, team building, hiring and performance management - **Process and operational leadership:** Establishing engineering practices, incident response, capacity planning - **Strategic and business leadership:** Roadmap planning, stakeholder management, resource allocation ## Story Organization & Delivery: Managing Narrative Complexity Senior-level projects are inherently complex, often spanning months or years with multiple workstreams and stakeholders. Because the stories are longer, traditional STAR formatting breaks down when trying to capture this complexity. **Use the "Table of Contents" approach:** Begin with a brief overview of the major themes or phases you'll cover. For example: "This migration had three critical parts: the technical architecture decisions, managing organizational change across five teams, and handling the customer communication during the transition." **Front-load the impact:** Don't bury your results at the end. Senior interviewers may interrupt with detailed follow-ups, and you might never reach your conclusion. Include the results in the Situation section, with the business impact, then explain how you achieved it. **Prepare for interruptions:** Speaking of interruptions, senior behavioral interviews tend to be more conversational but also more impatient. Interviewers will dive deep into decision-making processes, ask about alternatives you considered, or explore specific aspects of team dynamics. Prepare modular story components you can expand or condense based on their interests. After you finish a follow up question, nudge the interviewer back to the next theme so you can continue to deliver signal on what you accomplished. **Add details that demonstrate scope:** Every detail should serve a purpose—to show technical complexity, organizational challenge, or strategic thinking. Mentioning "coordinating across 12 engineers in 4 time zones" signals scope. Describing "migrating 500M+ daily transactions with zero downtime" demonstrates both technical and business impact. **Leave out details that result in redundant takeaways:** The natural follow up to adding those kinds of details is leaving out ones that have the same takeaways you’ve established. If you’re discussing the third challenging technical situation on this project in gory detail, you are spending time harping on the same message—”I am technical”—when you could be using that time to establish other aspects of your career. **Know your audience:** Interviewers at this level can operate with less systematic structure and higher variance in interviewer approaches or you might be interviewed by XFN partners. Pay attention to what they're probing for and adjust your stories accordingly. A VP might care more about business impact and organizational alignment, a PM will ask about working with non-technical partners, while a Principal Engineer might dive deep into technical decision-making frameworks. **Observe and respond to your interviewer:** Watch for the listener’s engagement while you tell your story and adjust your level of detail accordingly. If they are frequently asking for elaboration, then provide that up front. If they haven’t written anything down for a while, consider whether you’re sharing relevant actions you’ve taken and consider moving on to another part of the story. ## Thinking Defensively Behavioral interviewers make subjective judgments in 45-60 minutes, often reading between the lines and jumping to conclusions. Senior interviewers, having witnessed hiring mistakes, are naturally cautious—especially for leadership roles where a problematic hire can cascade across the organization. Even when your actions weren't "wrong," you can leave yourself open to uncharitable interpretations. Any gaps in your narrative get filled with assumptions that may not favor you. Read more about thinking defensively on [this post](https://thebehavioral.substack.com/p/thinking-defensively-in-behavioral) from Mastering Behavioral Interviews. ### Common Problematic Framings **Passive ownership:** "I came to the sprint meeting and the manager assigned me this ticket..." signals weak ownership and junior-level thinking rather than business-focused initiative. **Lack of proactivity:** "The codebase lacked test coverage so it took me a while..." or "The executive didn't have visibility so it was under-resourced..." suggests you notice problems but don't drive solutions. **Letting ambiguity persist:** "The stakeholders had different opinions, so we scheduled several alignment meetings..." shows weak decision-making rather than driving through uncertainty. **One-way communication:** "The team documented the API changes in our wiki, but some teams still had integration issues..." treats communication as broadcast rather than ensuring understanding. ### Identifying Weak Spots Use mock interviewers to spot story weaknesses you can't see yourself. Review your stories for potential negative signal by journaling about weaknesses. Be suspicious of follow-up questions—they often target perceived weaknesses. ### Defensive Strategies The key is proactively addressing concerns and carefully framing your stories to avoid uncharitable interpretations that could derail your candidacy. **Elide problematic parts:** Instead of mentioning your manager assigned the ticket, say "I came out of the sprint meeting with this high-impact task..." **Proactively frame unavoidable issues:** Explain your rationale. For the stakeholder alignment example: "We strategized extensively and came in with a clear position, but executives were at odds about strategic direction. I realized this wasn't a product decision but a business question, so I prepared data on user engagement and revenue impact, then facilitated a decision-making session to resolve the strategic conflict with concrete evidence." **Acknowledge mistakes with learning:** "The team documented changes in our wiki, but some teams had integration issues. I realized we were hasty launching without coordination. I led changes to our process, having the tech lead add Change Management to planning docs for the future." _Interested in more behavioral content? Check out [Mastering Behavioral Interviews](https://thebehavioral.tech/) for a complete preparation guide._ ================================================ FILE: apps/website/contents/behavioral-interview.md ================================================ --- id: behavioral-interview title: 'Behavioral interviews for Software Engineers: How to prepare' description: How to prepare for Software Engineer behavioral interviews keywords: [ software engineer behavioral interview prep, software developer behavioral interview prep, behavioral interview software engineer, how to prepare for behavioral interview software engineer, google behavioral interview, facebook behavioral interview, amazon behavioral interview, microsoft behavioral interview, ] sidebar_label: Step-by-step how to prepare --- import InDocAd from './\_components/InDocAd'; _The following page is a collaboration with [Austen McDonald](https://www.linkedin.com/in/austenmc/), former Senior Engineering Manager and Hiring Committee Chair at Meta, and author of [Mastering Behavioral Interviews](http://thebehavioral.tech/)._ ## What are behavioral interviews Succeeding in an engineering career involves more than just technical skills. People skills become more important as an engineer becomes more senior. Senior engineers should have the ability to lead and influence, resolve conflicts, anticipate risks, plan the roadmap, and more. Hiring a talented engineer that cannot work with others can ultimately be a net deficit for companies. Companies don't want to hire [brilliant jerks](https://www.brendangregg.com/blog/2017-11-13/brilliant-jerks.html). The company is better off not hiring a very talented engineer who refuses to work with others or causes an entire team to be unproductive. Companies want to hire the right person that will work well with the existing employees and help the team and company achieve greater heights, and behavioral interviews are one way of determining if someone will be good to work with from a non-technical standpoint. Typically, behavioral interview questions can be split into several types: 1. Getting to know your career preferences, ambitions and plans 1. Discuss details of experiences or projects written in your resume 1. "Tell me about a time where you" type of questions where you describe how you demonstrated certain traits or responded to a situation ## The importance of behavioral interviews Companies value behavioral skills and do evaluate candidates on them. At the time of writing, Facebook has one round (out of four) dedicated to behavioral interviews. Airbnb has TWO rounds (out of six) dedicated to behavioral interviews/company fit. Lyft has one round (out of five) dedicated to past experience and situational questions by a hiring manager. From the company's perspective, the interview has two purposes: - Assess whether a candidate has a history of demonstrating the right behaviors that would make them successful at the company. - Assess the seniority of the candidate e.g. junior, senior, or staff. The importance of behavioral interviews is increasing as AI generates more code. Soft skills—how you work with people, and especially qualities like communication and willingness to learn—are pivotal as companies expect more from their engineers than simply implementation ## How to prepare for behavioral interviews 1. Learn the STAR answer format 1. Prepare your answers to commonly asked questions 1. Prepare experiences to showcase fit to the company's culture / core values 1. Try out mock behavioral interviews 1. Use structured courses ### 1. Learn the STAR answer format The [STAR](https://en.wikipedia.org/wiki/Situation,_task,_action,_result) format is a framework to help you organize answers to behavioral questions - especially ones requiring you to discuss previous experiences - **Situation** - The interviewer wants you to present a recent challenge and situation which you found yourself in - **Task** - What were you required to achieve? The interviewer will be looking to see what you were trying to achieve from the situation. Some performance development methods use "Target" rather than "Task". Job interview candidates who describe a "Target" they set themselves instead of an externally imposed "Task" emphasize their own intrinsic motivation to perform and to develop their performance - **Action** - What did you do? The interviewer will be looking for information on what you did, why you did it, and what the alternatives were - **Results** - What was the outcome of your actions? What did you achieve through your actions and what did you learn? What steps did you take to improve after the experience? #### Example of how to apply STAR to a behavioral interview question Here's an example of how the STAR format can be used to answer the question: "Tell me about a time in which you had a conflict and needed to influence somebody else". #### Situation​ > "I was the team lead of a school project about building a social network mobile web app. Our designer's midterms were approaching and didn't have time to produce the mockups. Our front-end person was rushing him for the mockups so that he could proceed with his work, and that was stressing the designer out. The atmosphere in the team was tense." #### Task​ > "As the team lead, I had to resolve the tension between the front-end developer and the designer so that the team could work together peacefully and complete the project on time." #### Action​ > "I spoke to the front-end developer to ask him why he was rushing the designer for the designs. He said that he wanted the designs early because it would be a waste of time rebuilding if the designer designed something different eventually. I explained to him that the midterm dates were out of the designer's control and we had to be more understanding about each other's schedules. I spoke to the designer to get a rough idea of what he had in mind and asked him when he could commit to producing the high-fidelity designs. He replied that he could start on them as soon as his midterms were over. I explained to him why the front-end developer was pushing him for the mockups, and that the front-end developer had no ill intentions and simply wanted the project to succeed. As someone with some experience in UI/UX design, I came up with wireframe mocks, ran them by the designer for approval, then passed them to the front-end developer to start building. I encouraged the front-end developer to use placeholders and not be too concerned about the details for now. We could build the non-UI parts first (authentication, hook up with APIs) and tweak pixels and add polish later on. The front-end developer agreed and went ahead with the approach. I explained to the front-end developer that the designer will pass us the mockups after his midterm, by <DATE>." #### Result​ > "When our designer ended midterms, he came back with beautiful mockups that fit well into the wireframes. Our front-end developer implemented them with great care to detail. We ended up scoring top marks for the project and became a great team." **Pro tip:** to show seniority and strong signal around growth, consider adding an additional R for Reflection. Finish your story with a look back at what you learned and took away. For more about this expanded version of STAR(R), check out [this post](https://thebehavioral.substack.com/p/using-the-carl-method-to-structure). ### 2. Organize your key stories Unlike preparing for a coding interview, drilling common questions is unlikely to be your best preparation strategy. Instead, you’ll likely find yourself leveraging a few key stories from larger projects in your career to answer most questions. It’s common for a project to have elements of addressing ambiguity and resolving conflict and communication, etc. Spend some time going through your past experiences, your resume, any performance reviews you may have access to, etc. and collect 3-5 projects that have high impact, high complexity, and high involvement by you. Consider projects like these: **High-Impact Projects:** Major launches, significant refactors, system migrations, new product features, architecture decisions that influenced multiple teams. **Challenging Situations:** Tight deadlines, technical failures, team or interpersonal conflicts, ambiguous requirements, projects where success was uncertain. **Leadership Moments:** Mentoring others, driving cross-team initiatives, representing your team externally, times when others looked to you for direction. **Learning Experiences:** Mistakes that led to growth, feedback that changed your approach, skills you developed under pressure, times when you had to completely rethink your approach. Construct a STAR(R) story for each project as an exercise in storytelling. Pay special attention to the Actions: these are the repeatable “behaviors” that the interview is named after. The company is not hiring you to do the same project you’ve done in the past but to engage in similar behaviors on their projects. ### 3. Prepare answers to the Big Three Questions Despite our advice that preparing for specific questions has limited value, there are three questions that are very very common and it’s worth preparing in advance: - Tell me about yourself: this question opens almost any interview. See our advice at in [Preparing a self introduction](./self-introduction.md) and a further dive [here](https://thebehavioral.substack.com/p/death-taxes-and-tmay). - Tell me about your favorite project/most impactful project/etc.: pick a project at the intersection of impact, scope, and your personal involvement. - Tell me about time when you resolved a conflict: this is the most common soft skill question. Check out a series of posts on choosing and structuring a response starting [here](https://thebehavioral.substack.com/p/conflict-stories-1-of-5-workplace). While most people might be inclined towards memorization, it's much better to pen down bullet points to each question and practice verbalizing them near to the interviews, so that your answers will come out more naturally. ### 4. Practice other questions by yourself or with AI Even though trying to anticipate questions beyond the Big Three is challenging, you can get a lot of value out of practicing your story telling skills on sample questions. You may refer to [my list of 30 questions](./behavioral-interview-questions.md) which were collated across top tech companies for this. Also, going through this process will help you identify if there are significant gaps in your story catalog centered around specific signal areas. For example, perhaps you need more stories around past mistakes or . This is a natural place to use chatbots: prompt an LLM to ask you these questions and give you feedback on your responses. Also encourage the AI to ask you follow up questions. ### 5. Prepare experiences to showcase fit to the company's culture / core values As aforementioned, most top tech companies use their company values to evaluate candidates in behavioral interviews. As such, you should do your research to find out what those values are and ensure you have prepared experiences that showcase fit. ### 6. Try out mock behavioral interviews If you would like to practice behavioral interviews with professional interviewers from top tech companies, schedule one with [interviewing.io](https://iio.sh/r/DMCa). Interviewing.io boasts a large pool of interviewers from Facebook, Amazon, Apple, Google and Microsoft. I have used [interviewing.io](https://iio.sh/r/DMCa) both as an interviewer and interviewee and can guarantee a good experience with this platform. For some advice on how to maximize your experience with mock interviewers, check out [this post](https://thebehavioral.substack.com/p/getting-the-most-out-of-mock-behavioral). ### 7. Expand your knowledge with newsletters, books, and courses I've seen candidates get rejected for failing the behavioral round even though they did super well on the coding and system design interviews and if AI will be generating more and more code, behavioral interviews are getting more important—of course they’ve always been important for senior roles. Check out the free newsletter [Mastering Behavioral Interviews](https://thebehavioral.substack.com/) on Substack and the [accompanying book](https://thebehavioral.tech/). There are also courses available: - ["Behavioral Interviews" by Exponent](https://www.tryexponent.com/courses/behavioral?ref=techinterviewhandbook) - While Exponent also has courses on technical content, what really makes them stand out from the other interview preparation platform is their availability of content for non-software engineering roles such as Product Management and Product Marketing. Their behavioral interview course is a mix of videos (by the Exponent CEO himself!) and text, going through the most common questions and imparting you with techniques to help you ace the interview. To top it off, they also have an interview question bank for behavioral questions with responses from the platform's helpful community. While the subscription might be a little pricey for just the behavioral interviews content, they also offer quality technical content for [System Design](https://www.tryexponent.com/courses/system-design-interviews?ref=techinterviewhandbook), [Data Structures](https://www.tryexponent.com/courses/swe-practice?ref=techinterviewhandbook) and [Algorithms](https://www.tryexponent.com/courses/algorithms?ref=techinterviewhandbook). The convenience of a one-stop platform which covers all aspects of technical interview preparation is very enticing. - ["Grokking the Behavioral Interview" on Educative](https://www.educative.io/courses/grokking-the-behavioral-interview?aff=x23W) - As per other courses on Educative, this course is text-based and they believe that text-based courses are the more efficient than video courses. One thing that stands out about this course is that they teach you **patterns** for behavioral interviews, not just about memorizing questions and preparing answers. ================================================ FILE: apps/website/contents/best-coding-interview-courses.md ================================================ --- id: best-coding-interview-courses title: Best coding interview courses description: Best courses to take to prepare for your coding interviews sidebar_label: 🔥 Best interview courses keywords: [algorithm, coding, interview, questions] --- If you prefer courses where the learning is more structured, here are a few recommendations. **In no way is taking online courses a must in order to pass interviews.** ## General import AlgorithmCourses from './\_courses/AlgorithmCourses.md' ## Python | Course | Reviews | Duration | Price | Contents | | :-- | --- | --- | --- | --- | | [Ace the Python Coding Interview](https://www.educative.io/path/ace-python-coding-interview?aff=x23W) | 4.6/5 | 93h | $ | Basic data structures and algorithms + practice. Also includes **system design** and concurrency | | [The Complete Data Structures and Algorithms Course in Python](https://fxo.co/DQpc) | 4.6/5 | 41h | $ | Basic data structures and algorithms | | [Python for Data Structures, Algorithms, and Interviews!](https://fxo.co/DQpb) | 4.5/5 | 16.5h | $$ | Basic data structures and algorithms, job application, behavioral interview, negotiation | ## Java | Course | Reviews | Duration | Price | Contents | | :-- | --- | --- | --- | --- | | [Ace the Java Coding Interview](https://www.educative.io/path/ace-java-coding-interview?aff=x23W) | 4.6/5 | 55h | $ | Basic data structures and algorithms + practice. Also includes **system design** | | [Java Data Structures and Algorithms Masterclass](https://fxo.co/DQpa) | 4.5/5 | 45h | $ | Basic and advanced data structures and algorithms | | [Data Structures and Algorithms: Deep Dive Using Java](https://fxo.co/DQpW) | 4.5/5 | 16h | $$ | Basic data structures and algorithms | ## JavaScript | Course | Reviews | Duration | Price | Contents | | :-- | --- | --- | --- | --- | | [Ace the JavaScript Coding Interview](https://www.educative.io/path/ace-javascript-coding-interview?aff=x23W) | 4.7/5 | 87h | $ | Basic data structures and algorithms + practice. Also includes **system design** | | [JavaScript Data Structures and Algorithms Masterclass](https://fxo.co/DQpZ) | 4.5/5 | 45h | $ | Basic and advanced data structures and algorithms | | [Master the Coding Interview: Data Structures + Algorithms](https://fxo.co/DQpY) | 4.6/5 | 19.5h | $$ | Basic data structures and algorithms, job application, behavioral interview, negotiation | ## C++ | Course | Reviews | Duration | Price | Contents | | :-- | --- | --- | --- | --- | | [Ace the C++ Coding Interview](https://www.educative.io/path/ace-cpp-coding-interview?aff=x23W) | 4.6/5 | 60h | $ | Basic data structures and algorithms + practice. Also includes **system design**, concurrency and behavioral contents | ================================================ FILE: apps/website/contents/best-practice-questions.md ================================================ --- id: best-practice-questions title: Best practice questions sidebar_label: 🔥 Best practice questions description: The best practice questions to prepare for algorithmic coding interviews by the author of Blind 75 spread across a 5-week schedule keywords: [algorithm, coding, interview, questions, leetcode, blind 75] displayed_sidebar: docs pagination_next: coding-interview-cheatsheet --- import AlgorithmCourses from './\_courses/AlgorithmCourses.md' import InDocAd from './\_components/InDocAd'; Best practice questions by the author of Blind 75 | Tech Interview Handbook :::tip As of April 2022, I've developed a [12-week study plan](./coding-interview-study-plan.md) which includes a curriculum for revision and practice questions. If you want to customize your own practice questions, I've also developed [Grind 75](https://www.techinterviewhandbook.org/grind75/) which is a modern version of Blind 75 that you can customize. ::: Hey there, the author of Blind 75 here 👋! Practicing is the best way to prepare for coding interviews. LeetCode has over a thousand questions. Which should you practice? Hence years ago, I curated a list of the most important 75 questions on [LeetCode](https://leetcode.com). Many other LeetCode questions are a mash of the techniques from these individual questions. I used this list in my last job hunt to only do the important questions. I [shared this list on Blind](https://www.teamblind.com/post/New-Year-Gift---Curated-List-of-Top-100-LeetCode-Questions-to-Save-Your-Time-OaM1orEU) by extracting the questions from [my freeCodeCamp article](https://www.freecodecamp.org/news/coding-interviews-for-dummies-5e048933b82b/) to save peoples' time when revising and someone reposted this list on [the LeetCode forum](https://leetcode.com/discuss/post/460599/blind-75-leetcode-questions-by-krishnade-9xev/). It somehow blew up and became super famous in the coding interview scene, people even gave it a name - **Blind 75**. The Blind 75 questions as a LeetCode list can be found [here](https://leetcode.com/list/xi4ci4ig/). Years later, I further distilled the list down into only 50 questions and spread them across a 5-week schedule. Here is the suggested schedule for revising and practicing algorithm questions on LeetCode. Sign up for an account if you don't already have one, it's critical to your success in interviewing! When practicing, you are advised to treat it like a real coding interview and check through thoroughly before submitting. Consider even manually coming up with some test cases and running through them to verify correctness! I've created a [LeetCode list](https://leetcode.com/list/9h4lgwl2) for the following questions (except the Premium ones). Feel free to use it to track your practice progress. :::tip Expert tip If you're running low on time, [AlgoMonster](https://shareasale.com/r.cfm?b=1873647&u=3114753&m=114505&urllink=&afftrack=) aims to help you ace the technical interview **in the shortest time possible**. By Google engineers, [AlgoMonster](https://shareasale.com/r.cfm?b=1873647&u=3114753&m=114505&urllink=&afftrack=) uses a data-driven approach to teach you most useful key question patterns and has contents to help you quickly revise basic data structures and algorithms. **Learn and understand patterns, not memorize answers!** ::: ## Week 1 - Sequences In week 1, we will warm up by doing a mix of easy and medium questions on arrays and strings. Arrays and strings are the most common types of questions to be found in interviews; gaining familiarity with them will help in building strong fundamentals to better handle tougher questions. | Question | Difficulty | LeetCode | | :-- | --- | --- | | Two Sum | Easy | [Link](https://leetcode.com/problems/two-sum/) | | Contains Duplicate | Easy | [Link](https://leetcode.com/problems/contains-duplicate/) | | Best Time to Buy and Sell Stock | Easy | [Link](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/) | | Valid Anagram | Easy | [Link](https://leetcode.com/problems/valid-anagram/) | | Valid Parentheses | Easy | [Link](https://leetcode.com/problems/valid-parentheses/) | | Maximum Subarray | Easy | [Link](https://leetcode.com/problems/maximum-subarray/) | | Product of Array Except Self | Medium | [Link](https://leetcode.com/problems/product-of-array-except-self/) | | 3Sum | Medium | [Link](https://leetcode.com/problems/3sum/) | | Merge Intervals | Medium | [Link](https://leetcode.com/problems/merge-intervals/) | | Group Anagrams | Medium | [Link](https://leetcode.com/problems/group-anagrams/) | #### Optional | Question | Difficulty | LeetCode | | :-- | --- | --- | | Maximum Product Subarray | Medium | [Link](https://leetcode.com/problems/maximum-product-subarray/) | | Search in Rotated Sorted Array | Medium | [Link](https://leetcode.com/problems/search-in-rotated-sorted-array/) | ## Week 2 - Data structures The focus of week 2 is on linked lists, strings and matrix-based questions. The goal is to learn the common routines dealing with linked lists, traversing matrices and sequence analysis (arrays/strings) techniques such as sliding window, linked list traversal and matrix traversal. | Question | Difficulty | LeetCode | | :-- | --- | --- | | Reverse a Linked List | Easy | [Link](https://leetcode.com/problems/reverse-linked-list/) | | Detect Cycle in a Linked List | Easy | [Link](https://leetcode.com/problems/linked-list-cycle/) | | Container With Most Water | Medium | [Link](https://leetcode.com/problems/container-with-most-water/) | | Find Minimum in Rotated Sorted Array | Medium | [Link](https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/) | | Longest Repeating Character Replacement | Medium | [Link](https://leetcode.com/problems/longest-repeating-character-replacement/) | | Longest Substring Without Repeating Characters | Medium | [Link](https://leetcode.com/problems/longest-substring-without-repeating-characters/) | | Number of Islands | Medium | [Link](https://leetcode.com/problems/number-of-islands/) | | Remove Nth Node From End Of List | Medium | [Link](https://leetcode.com/problems/remove-nth-node-from-end-of-list/) | | Palindromic Substrings | Medium | [Link](https://leetcode.com/problems/palindromic-substrings/) | | Pacific Atlantic Water Flow | Medium | [Link](https://leetcode.com/problems/pacific-atlantic-water-flow/) | | Minimum Window Substring | Hard | [Link](https://leetcode.com/problems/minimum-window-substring/) | ## Week 3 - Non-linear data structures The focus of week 3 is on non-linear data structures like trees, graphs and heaps. You should be familiar with the various tree traversal (in-order, pre-order, post-order) algorithms and graph traversal algorithms such as breadth-first search and depth-first search. In my experience, using more advanced graph algorithms (Dijkstra's and Floyd-Warshall) is quite rare and usually not necessary. | Question | Difficulty | LeetCode | | :-- | --- | --- | | Invert/Flip Binary Tree | Easy | [Link](https://leetcode.com/problems/invert-binary-tree/) | | Validate Binary Search Tree | Medium | [Link](https://leetcode.com/problems/validate-binary-search-tree/) | | Non-overlapping Intervals | Medium | [Link](https://leetcode.com/problems/non-overlapping-intervals/) | | Construct Binary Tree from Preorder and Inorder Traversal | Medium | [Link](https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/) | | Top K Frequent Elements | Medium | [Link](https://leetcode.com/problems/top-k-frequent-elements/) | | Clone Graph | Medium | [Link](https://leetcode.com/problems/clone-graph/) | | Course Schedule | Medium | [Link](https://leetcode.com/problems/course-schedule/) | | Serialize and Deserialize Binary Tree | Hard | [Link](https://leetcode.com/problems/serialize-and-deserialize-binary-tree/) | | Binary Tree Maximum Path Sum | Hard | [Link](https://leetcode.com/problems/binary-tree-maximum-path-sum/) | #### Optional | Question | Difficulty | LeetCode | | :-- | --- | --- | | Maximum Depth of Binary Tree | Easy | [Link](https://leetcode.com/problems/maximum-depth-of-binary-tree/) | | Same Tree | Easy | [Link](https://leetcode.com/problems/same-tree/) | | Binary Tree Level Order Traversal | Medium | [Link](https://leetcode.com/problems/binary-tree-level-order-traversal/) | | Encode and Decode Strings | Medium | [Link](https://leetcode.com/problems/encode-and-decode-strings/) (Premium) | ## Week 4 - More data structures Week 4 builds up on knowledge from previous weeks but questions are of increased difficulty. Expect to see such level of questions during interviews. You get more practice on more advanced data structures such as (but not exclusively limited to) heaps and tries which are less common but are still asked. | Question | Difficulty | LeetCode | | :-- | --- | --- | | Subtree of Another Tree | Easy | [Link](https://leetcode.com/problems/subtree-of-another-tree/) | | Lowest Common Ancestor of BST | Easy | [Link](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/) | | Implement Trie (Prefix Tree) | Medium | [Link](https://leetcode.com/problems/implement-trie-prefix-tree/) | | Add and Search Word | Medium | [Link](https://leetcode.com/problems/design-add-and-search-words-data-structure/) | | Kth Smallest Element in a BST | Medium | [Link](https://leetcode.com/problems/kth-smallest-element-in-a-bst/) | | Merge K Sorted Lists | Hard | [Link](https://leetcode.com/problems/merge-k-sorted-lists/) | | Find Median from Data Stream | Hard | [Link](https://leetcode.com/problems/find-median-from-data-stream/) | | Insert Interval | Medium | [Link](https://leetcode.com/problems/insert-interval/) | | Longest Consecutive Sequence | Medium | [Link](https://leetcode.com/problems/longest-consecutive-sequence/) | | Word Search II | Hard | [Link](https://leetcode.com/problems/word-search-ii/) | #### Optional | Question | Difficulty | LeetCode | | :-- | --- | --- | | Meeting Rooms | Easy | [Link](https://leetcode.com/problems/meeting-rooms/) (Premium) | | Meeting Rooms II | Medium | [Link](https://leetcode.com/problems/meeting-rooms-ii/) (Premium) | | Graph Valid Tree | Medium | [Link](https://leetcode.com/problems/graph-valid-tree/) (Premium) | | Number of Connected Components in an Undirected Graph | Medium | [Link](https://leetcode.com/problems/number-of-connected-components-in-an-undirected-graph/) (Premium) | | Alien Dictionary | Hard | [Link](https://leetcode.com/problems/alien-dictionary/) (Premium) | ## Week 5 - Dynamic programming Week 5 focuses on Dynamic Programming (DP) questions. Personally as an interviewer, I'm not a fan of DP questions as they are not really applicable to practical scenarios and frankly if I were made to do the tough DP questions during my interviews I'd not have gotten the job. However, companies like Google still ask DP questions and if joining Google is your dream, DP is unavoidable. DP questions can be hard to master and the best way to get better at them is... you guessed it - practice! Be familiar with the concepts of memoization and backtracking. Practically speaking the return of investment (ROI) on studying and practicing for DP questions is very low. Hence DP questions are less important/optional and you should only do them if you have time to spare and you're very keen to have all bases covered (and interviewing with Google). | Question | Difficulty | LeetCode | | :-- | --- | --- | | Climbing Stairs | Easy | [Link](https://leetcode.com/problems/climbing-stairs/) | | Coin Change | Medium | [Link](https://leetcode.com/problems/coin-change/) | | Longest Increasing Subsequence | Medium | [Link](https://leetcode.com/problems/longest-increasing-subsequence/) | | Combination Sum | Medium | [Link](https://leetcode.com/problems/combination-sum-iv/) | | House Robber | Medium | [Link](https://leetcode.com/problems/house-robber/) | | House Robber II | Medium | [Link](https://leetcode.com/problems/house-robber-ii/) | | Decode Ways | Medium | [Link](https://leetcode.com/problems/decode-ways/) | | Unique Paths | Medium | [Link](https://leetcode.com/problems/unique-paths/) | | Jump Game | Medium | [Link](https://leetcode.com/problems/jump-game/) | | Word Break | Medium | [Link](https://leetcode.com/problems/word-break/) | #### Dynamic programming course - [Grokking the Dynamic Programming Patterns for Coding Interviews](https://www.designgurus.io/course/grokking-dynamic-programming?aff=kJSIoU) ## Quality courses If you want more structured algorithms practice, I recommend the following courses: ================================================ FILE: apps/website/contents/career-growth.md ================================================ --- id: career-growth title: 📈 Career growth --- _The following page is written in collaboration with [Jordan Cutler](https://www.linkedin.com/in/jordancutler1/) — Author of ["High Growth Engineer" newsletter](https://read.highgrowthengineer.com/)._ After being hired, it's crucial to focus on your career growth so you don't stagnate. This page gives you the resources to get promoted and improve your skill set as an engineer. ## Newsletters - [High Growth Engineer](https://read.highgrowthengineer.com/) - [The Developing Dev](https://www.developing.dev/) - [The Pragmatic Engineer](https://newsletter.pragmaticengineer.com/) - [Level Up Software Engineering](https://levelupsoftwareengineering.substack.com/) - [Peak Performance](https://addyo.substack.com/) - [Engineer's Codex](https://read.engineerscodex.com/) - [Techlead Mentor](https://newsletter.techleadmentor.com/) - [The Caring Techie](https://www.thecaringtechie.com/) - [Refactoring](https://refactoring.fm/) - [Strategize Your Career](https://strategizeyourcareer.com/) - [Hungry Minds](https://www.hungryminds.dev/) - [Saiyan Growth Letter](https://www.saiyangrowthletter.com/) - [Data Engineering Newsletter](https://blog.dataengineer.io/) - [16x Engineer](https://16x.engineer/) ## Books - [Software Engineer's Guidebook](https://www.amazon.com/Software-Engineers-Guidebook-Navigating-positions/dp/908338182X) - [Engineers Survival Guide](https://www.amazon.com/Engineers-Survival-Guide-Facebook-Microsoft/dp/B09MBZBGFK) - [The Coding Career Handbook](https://learninpublic.org/) - [The Complete Software Developer's Career Guide](https://www.amazon.com/Complete-Software-Developers-Career-Guide-ebook/dp/B073X6GNJ1) - [Omar Halabieh 90-day career blueprint](https://www.omarhalabieh.com/90-day-career-blueprint/) - [StaffEng.com – Stories of reaching Staff-plus engineering roles](https://staffeng.com/) - [Get Promoted](https://www.amazon.com/Get-Promoted-Really-Missing-Holding-ebook/dp/B09WGJVR4Z) ## LinkedIn - [Ryan Peterman](https://www.linkedin.com/in/ryanlpeterman/): Author of "The Developing Dev" newsletter - [Jordan Cutler](https://www.linkedin.com/in/jordancutler1/): Author of "High Growth Engineer" newsletter - [Gergely Orosz](https://www.linkedin.com/in/gergelyorosz/): Author of "The Pragmatic Engineer" newsletter - [Addy Osmani](https://www.linkedin.com/in/addyosmani/): Author of "Peak Performance" newsletter and Engineering leader at Google - [Alex Chiou](https://www.linkedin.com/in/alexander-chiou/): Co-founder of Taro - [Rahul Pandey](https://www.linkedin.com/in/rpandey1234/): Co-founder of Taro - [Alex Xu](https://www.linkedin.com/in/alexxubyte/): Founder of ByteByteGo - [Navdeep Singh](https://www.linkedin.com/in/navdeep-singh-3aaa14161/): Creator of NeetCode - [Yangshun Tay](https://www.linkedin.com/in/yangshun/): Creator of Tech Interview Handbook, Blind 75 and CEO of GreatFrontEnd (me)! - [Neo Kim](https://www.linkedin.com/in/nk-systemdesign-one/): Creator of "System Design One" newsletter - [Caleb Mellas](https://www.linkedin.com/in/calebmellas/): Creator of "Level Up Software Engineering" newsletter - [Alexandre Zajac](https://www.linkedin.com/in/alexandre-zajac/): Creator of the "Hungry Minds" newsletter ## YouTube - [Fireship](https://www.youtube.com/@Fireship/) - [NeetCode](https://www.youtube.com/@NeetCode/) - [LeadDev](https://www.youtube.com/@LeadDev/) ## Communities - [Taro](https://www.jointaro.com/) - [Kent C. Dodds Discord Community](https://kentcdodds.com/discord) - [GreatFrontEnd](https://discord.com/invite/NDFx8f6P6B) ## References - [Path to Senior Engineer Handbook](https://github.com/jordan-cutler/path-to-senior-engineer-handbook) ================================================ FILE: apps/website/contents/choosing-between-companies.md ================================================ --- id: choosing-between-companies title: Choosing between companies --- import InDocAd from './\_components/InDocAd'; If you have passed the interviews and received multiple offers, congratulations on the feat! Now you are faced with yet another problem (albeit a good one!) of choosing between companies. Here we will provide some insights into the factors you should be considering when deciding on the company to join. Every individual is different and certain factors matter more/less to others, so only you can decide what is best for you. Do your due diligence by researching on the companies before deciding! ## Compensation First and foremost, compensation. Most technical roles at tech companies would receive compensation in similar components - Base salary, Bonuses, Stocks, and Sign On. The [Understanding Compensation](./understanding-compensation.md) section goes into more detail. Some companies are more flexible in their offer and allow candidates to choose between higher base salary or higher stocks. Base salary is the most straightforward to understand and you are being paid that same amount regardless of how well/poorly the company is doing. Bonuses are also usually a percentage of the base salary, so a high base salary is great for the risk-adverse. Not all stock grants are equal as well. Some companies have linear vesting cycles (you vest the same amount every year), some companies like Amazon and Snap have backloaded schemes (you vest less in the earlier years, more later), and there are pay attention to cliffs as well. [Stripe and Lyft](https://www.theinformation.com/articles/stripe-and-lyft-speed-up-equity-payouts-to-first-year) recently changed their stock structure and announced that they will speed up equity payouts to the first year. This sounds good initially, [but in reality there are some nuances](https://www.tanayj.com/p/employee-compensation-and-one-year). Regardless of company, **always negotiate** your offer, especially if you have multiple offers to choose from! Having multiple offers in hand is the best bargaining chip you can have for negotiation and you should leverage it. We go into this more in the [Negotiation](./negotiation.md) section. Use [Rora](https://www.teamrora.com/?utm_source=techinterviewhandbook&utm_medium=referral&utm_content=website_choosing_between_companies) for risk-free negotiation services. ## Products What does the company work on and is the company working on a domain you are interested in? Most big tech companies have teams working on all sorts of products. For these big tech companies, common products include ads networks, chat, enterprise offerings, video watching, payments, hardware products, industry-leading AI tools, internal tools, etc. Microsoft, Amazon, Apple and ByteDance have products in some of these areas as well. For many big companies, they are large enough that they build their own infra and internal tools for most technologies they use because most existing technologies on the market can't meet their scale. That said, each tech company is uniquely known for something and it's in their DNA. So if you are interested in specific areas and you are sure you can be able to work on them, the choice should be clearer: - Meta/Facebook - Social networks (Facebook, Instagram), chat (WhatsApp, Messenger), Metaverse stuff (Oculus) - Google - Search, browsers (Google Chrome), Google Maps, cloud infrastructure (Google Cloud Platform), enterprise collaboration (Google Suite) - Amazon - Cloud infrastructure (Amazon Web Services), e-commerce - Microsoft - Operating systems, Microsoft Office Suite - Apple - Hardware, operating systems, services (iCloud, Apple Music) Personally I feel more motivated and productive if I'm working on products which I use as an external user as well, as I have a better understanding of the product from a user perspective which can potentially lead to better engineering and product decisions. ### Prospective teams While a company can be working on various products, some products are only worked on in certain offices. For example, Google Singapore primarily works on Payments and if you're only interested in working on search, Google Singapore wouldn't be that great of a fit, although it is definitely a possibility to relocate to another country in future while still remaining as a Google employee. More on that on the [Transfers and mobility](#transfers-and-mobility) section below. Do find out what products and teams your intended location works on so that you have a better idea of how your potential working life looks like if you were to join that company. ## Company prospects If you are awarded stocks, the company's prospects will affect your compensation! Is the company poised to be successful in the coming years or are there factors hindering the company's progress? ## Career growth How fast does the company promote its employees and does the company provide opportunities for its employees to grow? In smaller companies, you will get to wear multiple hats and build many products from 0 to 1. It's great for people who like to grow their product building skills and launch products quickly. However, technical growth might be limited due to the company's focus on product work and less on building infrastructure, which is usually only needed at scale. There's little need for a Principal Engineer in a small startup of 10 people where everyone is scrambling to build products. Career growth might be limited by the size and scope of the company and its product offerings. Some companies promote their employees faster than the others. There's a saying that go to Google to rest and vest, go to Meta if you want to accelerate your career. I've found this to be quite accurate from what I experienced and from looking at my peers at Google. At Meta, engineers are required to get from E3 to E4 within 2 years and E4 to E5 within 3 years. On the other hand, Google has a slower promotion cycle - the average engineer at Google takes more than 2 years to get from L3 to L4, more than 3 years to get from L4 to L5 and more than 4 years to get from L5 to L6. At Google, the terminal level is L4 so there's no pressure to promote. None of my peers are L6 at Google but a few are already E6 at Meta and it is quite achievable. In my opinion, Google is a great place to learn to be excellent engineers. They require everything to be well-engineered, with design docs and high test coverage. Meta is a great place for career-driven folks who don't mind working harder to accelerate their career path. ## Company culture Company culture refers to the beliefs and behaviors of a company's leadership and its employees. The tech giants are famous for their unique cultures: - Google - Candidates are evaluated for their "Googleyness" factor during interviews, which is a set of traits Google employees should embody - "Doing the right thing", "Striving for excellence", "Comfort with ambiguity". As mentioned above, Google is known for their high emphasis on engineering quality and data-driven decision making approach. - Meta/Facebook - In Facebook's early days, their internal motto was "Move fast and break things", indicating their focus on shipping products fast. In 2014, Mark Zuckerberg changed it to "Move fast with stable infrastructure" as the platform has matured and stability should a focus. I wrote more about [Meta/Facebook's culture in a blog post](https://www.techinterviewhandbook.org/blog/my-experience-working-as-a-meta-facebook-engineer/#culture). - Netflix - Netflix's culture deck is publicly available on [their website](https://jobs.netflix.com/culture) and their core philosophy is **people over process**. They like to think of themselves as professional sports teams - keeping the star players and letting adequate performers go instead of operating like a family - tolerating bad behavior and showing unconditional love ### Engineering culture Since most readers are in tech roles, the tech culture of a company deserves special mention. [Gergely Orosz](https://twitter.com/GergelyOrosz) came up with [12 points](https://blog.pragmaticengineer.com/pragmatic-engineer-test/) to evaluate whether a tech company has a healthy software engineering culture 1. **Equity or profit sharing** - Do employees receive equity? 1. **Roadmap/backlog that engineers contribute to** - Do engineers contribute to the roadmap of their team? 1. **Engineers directly working with other ICs** - Do engineers work directly with other roles (Designers, PMs, Data Scientists, etc)? 1. **Code reviews and testing** - Do engineers peer code reviews and write tests often? 1. **CI and engineers pushing to prod** - Is there continuous integration or a way for engineers to deploy to production? 1. **Internal open source** - Can engineers access and contribute to code bases across the company? 1. **Healthy oncall as a priority** - Is the oncall load manageable? 1. **Technical managers** - Do the engineering managers possess technical background and skills? 1. **Career ladder (when above 10 engineers)** - Are career ladders and expectations for each level well-defined? 1. **Parallel IC & manager tracks (when above 30 engineers)** - Can one rise up the career ladder as an IC? 1. **Feedback culture** - Is it the practice to give feedback to each other/the company? 1. **Investing in professional growth** - Stipend for professional growth, mentorship program It's no surprise that the FAANG companies hit all 12 points. Read more about it on [his blog post](https://blog.pragmaticengineer.com/pragmatic-engineer-test/). Which company's culture resonates with you the most? ## Work-life balance While the common practice is for employees to work 40 hours a week and 8 hours a day, some places are infamous for being more stressful and asks more time from their employees. Some Chinese companies famously [require employees to work 6 days a week](https://www.reuters.com/world/china/chinese-tech-workers-disclose-working-hours-criticism-996-2021-10-14/). Most tech employees do not get paid when they work overtime, so sometimes a more accurate way of calculating your salary is dollars per hour instead of the raw annual total compensations Google is famous for being a company for moving slower and a place where people go to rest and vest (their stocks) while [Amazon scored a C- for work-life balance](https://www.comparably.com/companies/amazon/work-life-balance) in an employee survey. ## Transfers and mobility Does the company have offices around the globe where employees can possibly relocate to? This is obviously out of the question for smaller companies where there is only one headquarters, but some companies allow employees to be remote and some are even entirely remote! Meta, Google, Apple, and Stripe are examples of companies which have global presence and regional headquarters. At Meta and Google, mobility is extremely high given there are large engineering offices all across US, in London, Tel Aviv, and more recently, in Singapore. One of my managers at Meta has worked at **four** offices! Personally, I relocated from Meta/Facebook Menlo Park to Meta/Facebook Singapore right before COVID hit and a few of my Meta/Googler friends have done similar moves, some even moving from Singapore to the US. ================================================ FILE: apps/website/contents/coding-interview-cheatsheet.md ================================================ --- id: coding-interview-cheatsheet title: 'Coding interview cheatsheet: Best practices before, during and after' description: Tips on what to do before, during and after coding interviews to display hire signals according to coding interview evaluation criteria keywords: [ coding interview best practices, best practices for coding interviews, what to do during coding interview, what to do after coding interview, what to do before coding interview, how to display hire behavior in coding interview, how to pass coding interview, ] sidebar_label: Best practices before, during, and after --- import InDocAd from './\_components/InDocAd'; As coding interviews mature over the years, there are now firmer expectations on how candidates should behave during a coding interview. Some of these practices also help you to exhibit "hire" signals to the interviewer by displaying your ability to communicate well and deal with roadblocks. Deriving the best practices from top candidates and also based on [how you will be evaluated during a coding interview](./coding-interview-rubrics.md), we have summarized some of the top tips for how to behave during a coding interview in an exhaustive checklist - including top mistakes to avoid. You should read and familiarize with this guide even before you start practicing your coding interview questions. Accompanying LeetCode grinding with this guide will allow you to ingrain these important coding interview behaviors early on. ## What to do _before_ your coding interview - ✅ Dress comfortably. > Usually you do not need to wear smart clothes, casual should be fine. T-shirts and jeans are acceptable at most places. - ✅ Ensure you have read and prepared for your [self introduction](./self-introduction.md) and [final questions to ask](./final-questions.md). ### For virtual onsite coding interviews
Summary of what to do before a virtual onsite coding interview
What to do before a virtual onsite coding interview
- ✅ Prepare pen and paper. > In case you need to jot and visualize stuff. Drawings are especially helpful for trees / graphs questions - ✅ Use earphones or headphones and make sure you are in a quiet environment. > Avoid using speakers because if the echo is loud, communication is harder and participants repeating themselves will just result in loss of valuable time. - ✅ Check that your internet connection is working. - ✅ Check that your webcam and audio are working. - ✅ Familiarize and set up shortcuts in the coding environment (CoderPad / CodePen). > Set up the editor shortcuts, turn on autocompletion, tab spacing, etc. Interviewers are impressed if you know the shortcuts and use them well - ✅ Turn off the webcam if possible. > Most remote interviews will not require video chat and leaving it on only serves as a distraction and hogs network bandwidth. ### For phone screen coding interviews
Summary of what to do before a phone screen coding interview
What to do before a phone screen coding interview
- ✅ Use earphones and put the phone on the table. > Avoid holding a phone in one hand and only having one other hand to type - ✅ Request for the option to use Zoom/Google Meet/Hangouts or Skype instead of a phone call. > It is easier to send links or text across. ### For onsite whiteboarding coding interviews - ✅ Learn about whiteboard space management. > Leave space between lines of code in case you need to insert lines between existing code. ## What to do _during_ your coding interview
Summary of what to do during a coding interview
What to do during a coding interview
### 1. Make a good self introduction at the start of the interview - ✅ Introduce yourself in a few sentences under a minute or 2. > Follow our guide on how to make a good self introduction for software engineers - ✅ Sound enthusiastic! > Speak with a smile and you will naturally sound more engaging. - ❌ Do not spend too long on your self introduction as you will have less time left to code. ### 2. Upon receiving the question, make clarifications **Do not jump into coding right away.** Coding questions tend to be vague and underspecified on purpose to allow the interviewer to gauge the candidate's attention to detail and carefulness. Ask at least 2-3 clarifying questions. - ✅ Paraphrase and repeat the question back at the interviewer. > Make sure you understand exactly what they are asking. - ✅ Clarify assumptions (Refer to [algorithms cheatsheets](.//algorithms/study-cheatsheet.md) for common assumptions) - > A tree-like diagram could very well be a graph that allows for cycles and a naive recursive solution would not work. Clarify if the given diagram is a tree or a graph. - > Can you modify the original array / graph / data structure in any way? - > How is the input stored? - > If you are given a dictionary of words, is it a list of strings or a Trie? - > Is the input array sorted? (e.g. for deciding between binary / linear search) - ✅ Clarify input value range. > Inputs: how big and what is the range? - ✅ Clarify input value format > Values: Negative? Floating points? Empty? Null? Duplicates? Extremely large? - ✅ Work through a simplified example to ensure you understood the question. > E.g., you are asked to write a palindrome checker, before coding, come up with simple test cases like "KAYAK" => true, "MOUSE" => false, then check with the interviewer if those example cases are in line with their expectations - ❌ Do not jump into coding right away or before the interviewer gives you the green light to do so. ### 3. Work out and optimize your approach with the interviewer The worst thing you can do next is jump straight to coding - interviewers expect there to be some time for a 2-way discussion on the correct approach to take for the question, including analysis of the time and space complexity. This discussion can range from a few minutes to up to 5-10 minutes depending on the complexity of the question. This also gives interviewers a chance to provide you with hints to guide you towards an acceptable solution. - ✅ If you get stuck on the approach or optimization, use [this structured way](./coding-interview-techniques.md) to jog your memory / find a good approach - ✅ Explain a few approaches that you could take at a high level (don't go too much into implementation details). Discuss the tradeoffs of each approach with your interviewer as if the interviewer was your coworker and you all are collaborating on a problem. > For algorithmic questions, space/time is a common tradeoff. Let's take the famous [Two Sum](https://leetcode.com/problems/two-sum/) question for example. There are two common solutions > > 1. Use nested for loops. This would be O(n2) in terms of time complexity and O(1) in terms of space. > 2. In one pass of the array, you would hash a value to its index into a hash table. For subsequent values, look up the hash table to see if you can find an existing value that can sum up to the target. This approach is O(N) in terms of both time and space. Discuss both solutions, mention the tradeoffs and conclude on which solution is better (typically the one with lower time complexity) - ✅ State and explain the time and space complexity of your proposed approach(es). > Mention the Big O complexity for time and explain why (e.g O(n2) for time because there are nested for loops, O(n) for space because an extra array is created). Master all the time and space complexity using the [algorithm optimization techniques](./coding-interview-techniques.md#how-to-optimize-your-approach-or-solution). - ✅ Agree on the most ideal approach and optimize it. Identify repeated/duplicated/overlapping computations and reduce them via caching. Refer to the page on [optimizing your solution](./coding-interview-techniques.md#how-to-optimize-your-approach-or-solution). - ❌ Do not jump into coding right away or before the interviewer gives you the green light to do so. - ❌ Do not ignore any piece of information given. - ❌ Do not appear unsure about your approach or analysis. ### 4. Code out your solution while talking through it - ✅ Only start coding after you have explained your approach and the interviewer has given you the green light. - ✅ Explain what you are trying to achieve as you are coding / writing. Compare different coding approaches where relevant. > In so doing, demonstrate mastery of your chosen programming language. - ✅ Code / write at a reasonable speed so you can talk through it - but not too slow. > You want to type slow enough so you can explain the code, but not too slow as you may run out of time to answer all questions - ✅ Write actual compilable, working code where possible, not pseudocode. - ✅ Write clean, straightforward and neat code with as few syntax errors / bugs as possible. > Always go for a clean, straightforward implementation than a complex, messy one. Ensure you adopt a neat coding style and good coding practices as per language paradigms and constructs. Syntax errors and bugs should be avoided as much as possible. - ✅ Use variable names that explain your code. > Good variable names are important because you need to explain your code to the interviewer. It's better to use long variable names that explain themselves. Let's say you need to find the multiples of 3 in an array of numbers. Name your results array `multiplesOfThree` instead of array/numbers. - ✅ Ask for permission to use trivial functions without having to implement them. > E.g. `reduce`, `filter`, `min`, `max` should all be ok to use - ✅ Write in a modular fashion, going from higher-level functions and breaking them down into smaller helper functions. > Let's say you're asked to build a car. You can just write a few high level functions first: `gatherMaterials()`, `assemble()`. Then break down `assemble()` into smaller functions, `makeEngine()`, `polishWheels()`, `constructCarFrame()`. You could even ask the interviewer if it's ok to not code out some trivial helper functions. - ✅ If you are cutting corners in your code, state that out loud to your interviewer and say what you would do in a non-interview setting (no time constraints). > E.g., "Under non-interview settings, I would write a regex to parse this string rather than using `split()` which may not cover certain edge cases." - ✅ [Onsite / Whiteboarding] Practice whiteboard space management - ❌ Do not interrupt your interviewer when they are talking. Usually if they speak, they are trying to give you hints or steer you in the right direction. - ❌ Do not spend too much time writing comments. - ❌ Do not repeat yourself - ❌ Do not use bad variable names. - Do not use extremely verbose or single-character variable names, (unless they're common like `i`, `n`) variable names - ❌ Do not copy and paste code without checking (e.g. some variables might need to be renamed after pasting). ### 5. After coding, check your code and add test cases Once you are done coding, do not announce that you are done. Interviewers expect you to start scanning for mistakes and adding test cases to improve on your code. - ✅ Scan through your code for mistakes - such as off-by-one errors. > Read through your code with a fresh pair of eyes - as if it's your first time seeing a piece of code written by someone else - and talk through your process of finding mistakes - ✅ Brainstorm edge cases with the interviewer and add additional test cases. (Refer to [algorithms cheatsheets](.//algorithms/study-cheatsheet.md) for common corner cases) > Given test cases are usually simple by design. Brainstorm on possible edge cases such as large sized inputs, empty sets, single item sets, negative numbers. - ✅ Step through your code with those test cases. - ✅ Look out for places where you can refactor. - ✅ Reiterate the time and space complexity of your code. > This allows you to remind yourself to spot issues within your code that could deviate from the original time and space complexity. - ✅ Explain trade-offs and how the code / approach can be improved if given more time. - ❌ Do not immediately announce that you are done coding. Do the above first! - ❌ Do not argue with the interviewer. They may be wrong but that is very unlikely given that they are familiar with the question. ### 6. At the end of the interview, leave a good impression - ✅ Ask good final questions that are tailored to the company. > Read tips and [sample final questions to ask](./final-questions.md). - ✅ Thank the interviewer - ❌ Do not end the interview without asking any questions. ## What to do _after_ your coding interview
Summary of what to do after a coding interview
What to do after a coding interview
- ✅ Record the interview questions and answers down as these can be useful for future reference. - ✅ Send a follow up email or Linkedin invitation to your interviewer(s) thanking them for their time and the opportunity to interview with them. > As an interviewer myself, these can leave a lasting impression on me. ================================================ FILE: apps/website/contents/coding-interview-prep.md ================================================ --- id: coding-interview-prep title: 'Coding interviews: Everything you need to prepare' description: What to expect, how to prepare and how to excel in software Engineer coding interviews keywords: [ coding interview prep, coding interview, software engineer interview prep, software engineer coding interview, technical interview prep, technical interview, questions to practice, topics to study, how to prepare for coding interview, how to prepare for technical interview, ] sidebar_label: Step-by-step how to prepare --- import InDocAd from './\_components/InDocAd'; _The ultimate guide on how to efficiently prepare for your software engineering technical interview - coding test round._ If you have decided to embark on the arduous process of preparing for your coding interviews and you don't know how to maximize your time, this is the only guide you need to go from zero to hero on your coding test. ## What is a Software Engineering coding interview? Coding interviews are a form of technical interviews used to assess a potential software engineer candidate's competencies through presenting them with programming problems. Typically, coding interviews have a focus on data structures and algorithms, while other technical rounds may encompass [system design](./system-design.md) (especially for middle to senior level candidates). A coding interview round is typically 30 - 45 minutes. You will be given a technical question (or questions) by the interviewer, and will be expected to write code in a real-time collaborative editor such as CodePen or CoderPad (phone screen / virtual onsite) or on a whiteboard (onsite) to solve the problem within 30–45 minutes. ## How will you be evaluated during a coding interview? I have collated evaluation criteria across top tech companies and generalized them into a [coding interview evaluation rubric](./coding-interview-rubrics.md) you can use. Specific terminology or weightages may differ across companies, top tech companies always include the following criteria in their evaluation: 1. **Communication** - Asking clarifying questions, communication of approach and tradeoffs clearly such that the interviewer has no trouble following. 1. **Problem solving** - Understanding the problem and approaching it systemically, logically and accurately, discussing multiple potential approaches and tradeoffs. Ability to accurately determine time and space complexity and optimize them. 1. **Technical competency** - Translating discussed solutions to working code with no significant struggle. Clean, correct implementation with strong knowledge of language constructs. 1. **Testing** - Ability to test code against normal and corner cases, self-correcting issues in code. Read more about [how you should behave in a coding interview to display hire signals](./coding-interview-cheatsheet.md). ## How to best prepare for a coding interview? LeetCode by itself is actually not enough to prepare you well for your coding interviews. Diving straight into LeetCode and thinking you can complete all of the thousands of questions is a bad use of your time and will never prepare you as well as a structured approach. Given 30 min per question and an average of 3 hours practice a day, the average person will only manage to complete 160 questions within 3-4 weeks, and may not internalize the right approach or remember the questions they have practiced before. Instead, this is how to prepare for your Software Engineer coding interview: 1. [Pick a good programming language to use](#pick-programming-language) 1. [Plan your time and tackle topics and questions in order of importance](#plan) 1. [Combine studying and practicing for a single topic](#study-and-practice) 1. [Accompany practice with coding interview cheat sheets to internalize the must-dos and must-remembers](#practice-with-cheatsheets) 1. [Prepare a good self introduction and final questions](#prepare-self-introduction) 1. [Try out mock coding interviews (with Google and Facebook engineers)](#mock-interviews) 1. [(If you have extra time) Internalize key tech interview question patterns](#question-patterns) ### 1. Pick a good programming language to use {#pick-programming-language} A good programming language to use for coding interviews is one you are familiar with and is suitable for interviews. What determines if a programming language should be used for interviews? Generally, we want higher level languages that have many standard library functions and data structures and are therefore "easier" to code in. Recommended programming languages to use for coding interviews: Python, C++, Java, JavaScript Read more about [considerations for picking a programming language](./programming-languages-for-coding-interviews.md) here. ### 2. Plan your time and tackle topics and questions in order of importance {#plan} How long does it take to prepare for a coding interview? It actually depends on how well prepared you want to be. On average, it takes about [30 hours to cover the bare minimum and ~100 hours to be well prepared](./coding-interview-study-plan.md). To start preparing for your coding interviews, always begin with a plan. Calculate the amount of time you have left to realistically prepare for your interview from now till the day of the coding test, and carefully make a plan of the topics and questions you will cover per day, prioritizing the most important ones first. But how do you know which are the most important topics and questions to practice based on the time you have left? You may use the free [Grind 75 tool](https://www.techinterviewhandbook.org/grind75/) (built by me) which produces coding interview study plans for varying lengths of preparation time. The algorithm behind it includes a ranking of questions by priority and also a balance between breadth and depth of topics covered. If you have the luxury of time to prepare, it is recommended to spend around 3 months (2-3 hours per day) to prepare more holistically. I came up with a [personal 3-month study plan](./coding-interview-study-plan.md), which takes you from start to finish on which topics and questions to complete. ### 3. Combine studying and practicing for a single topic {#study-and-practice} For the sake of memory retention and efficiency, it is best to study for a single concept and then immediately do relevant practice questions for that topic. Fortunately, there are already excellent coding interview preparation resources which enable you to do this very easily and systematically: 1. [AlgoMonster](https://shareasale.com/r.cfm?b=1873647&u=3114753&m=114505&urllink=&afftrack=) 1. [Grokking the Coding Interview: Patterns for Coding Questions](https://www.designgurus.io/course/grokking-the-coding-interview?aff=kJSIoU) #### [AlgoMonster](https://shareasale.com/r.cfm?b=1873647&u=3114753&m=114505&urllink=&afftrack=) Apart from helping you master important coding interview data structures and algorithm questions through practice and easy to understand guides, AlgoMonster has the added perk of synthesizing [common interview question patterns](https://algo.monster/problems/stats) that you could apply to solve any other questions you have never encountered before. Made by Google engineers, this is definitely a quality platform to use as compared to the unstructured nature of LeetCode grinding. Data structures and algorithms questions are covered in all the common languages - Python, Java, C#, JavaScript, C++, Golang, and more. [**Join today for a 70% discount →**](https://shareasale.com/r.cfm?b=1873647&u=3114753&m=114505&urllink=&afftrack=) #### [Grokking the Coding Interview: Patterns for Coding Questions](https://www.designgurus.io/course/grokking-the-coding-interview?aff=kJSIoU) This course by Design Gurus expands upon the questions on the recommended practice questions but approaches the practicing from a questions pattern perspective, which is an approach I also agree with for learning and have personally used to get better at coding interviews. The course allows you to practice selected questions in Java, Python, C++, JavaScript and also provides sample solutions in those languages along with step-by-step visualizations. **Learn and understand patterns, not memorize answers!** [**Get lifetime access today →**](https://www.designgurus.io/course/grokking-the-coding-interview?aff=kJSIoU) ### 4. Accompany practice with coding interview cheatsheets to internalize the must-dos and must-remembers {#practice-with-cheatsheets} To maximize what you get out of your practice, I recommend referring to the following coding interview cheatsheets _while_ you are studying and practicing: - **Coding interview techniques**: how to find a solution and optimize your approach - **Coding interview best practices**: how to behave through the interview to exhibit hire signals - **Algorithms study cheatsheets**: covers the best learning resources, must remembers (tips, corner cases) and must do practice questions for every data structure and algorithm #### Coding interview techniques Here is [list of around 10 techniques](./coding-interview-techniques.md) to do the 2 most important things you need to do in a coding interview: finding approaches to solve the problem presented, and optimizing the time and space complexity of your approaches. These techniques are useful to apply when you are given questions which you have never encountered before, and to get out of being stuck. #### Coding interview best practices Top tech companies evaluate candidates on 4 main criteria: communication, problem solving, technical competency and testing. To exhibit behaviors that fulfill these criteria, I have prepared a [coding interview best practices cheatsheet](./coding-interview-cheatsheet.md) which outlines what you should do before, during and after coding interviews. This is based on my personal experience as an interviewee as well as my observation of top candidates as an interviewer at Facebook. Using this guide to accompany practice ensures that you cultivate good habits and muscle memory with regards to interviews right from the beginning. #### Algorithms study cheatsheets for coding interviews These are actually the notes I personally collated for my own coding interview preparation. I have organized them into 1-pagers of the best study resources, best LeetCode questions to practice, and must-remembers (tips, corner cases) for every data structure and algorithm. They ensure that you internalize the most important concepts and get the most out of your preparation. [Check them out](./algorithms/study-cheatsheet.md). ### 5. Prepare a good self introduction and final questions {#prepare-self-introduction} Self introductions and final questions to ask are almost always required at the start and end of any software engineering interview. As such, you should always spend some time to craft an excellent self introduction and set of final questions to ask. When done well, these can leave a good impression with the interviewer that can turn things to your favor. For the best software self introduction samples and tips, check out this [self introduction guide for software engineers](./self-introduction.md). Also check out samples of the best final questions to ask for software engineers in this [final questions guide](./final-questions.md). ### 6. Try out mock coding interviews {#mock-interviews} Coding right in front of your interviewer can be a nerve-wracking experience especially if you have never done it before - which is why getting hands-on experience is so important. [interviewing.io](https://iio.sh/r/DMCa) is currently the best mock technical interview resource in the market. It allows you to book mock coding interviews with real Google and Facebook engineers, albeit anonymously. You could even book interviews for specific roles like Mobile, Front End, Engineering Management. Even better - if you want to have an easier transition into real world coding interview - you could view recorded interviews and see what phone interviews are like. Moreover, if you were to do very well on your mock interviews, you will be able to unlock the "jobs page" which allows you to book interviews directly with top companies like Uber, Lyft, Quora, Asana and more. I've used [interviewing.io](https://iio.sh/r/DMCa) both as an interviewer and an interviewee and found the experience to be excellent. Read more about [different mock coding interview platforms here](./mock-interviews.md). ### 7. (If you have extra time) Internalize key tech interview question patterns {#question-patterns} Many coding interview solutions actually involve a similar set of key patterns - and learning them will help you solve any long tail problem that is outside the set of commonly asked coding interview questions. #### AlgoMonster Out of the resources on the internet - AlgoMonster is an excellent platform created by Google engineers. It uses a data-driven approach to condense software engineering coding interview questions into a set of key patterns, and summarized them into a structured, easy to digest course. Imagine LeetCode, but with only the key patterns you need to know. Best of all, AlgoMonster is not subscription-based - pay a one-time fee and get lifetime access. [Join today for a 70% discount →](https://shareasale.com/r.cfm?b=1873647&u=3114753&m=114505&urllink=&afftrack=) #### Grokking the Coding Interview: Patterns for Coding Questions This course by Design Gurus expands upon the questions on the recommended practice questions but approaches the practicing from a questions pattern perspective, which is an approach I also agree with for learning and have personally used to get better at coding interviews. The course allows you to practice selected questions in Java, Python, C++, JavaScript and also provides sample solutions in those languages. Learn and understand patterns, not memorize answers! [Join today for a 10% discount →](https://www.designgurus.io/course/grokking-the-coding-interview?aff=kJSIoU) --- And that is all from me - for more detail on each step of the software engineer coding interview preparation process, do dive into each topic within my handbook through the sidebar or by navigating to the next page! ================================================ FILE: apps/website/contents/coding-interview-rubrics.md ================================================ --- id: coding-interview-rubrics title: How candidates are evaluated in coding interviews at top tech companies description: Detailed coding interview rubrics collated from Google, Amazon, Apple, Netflix keywords: [ coding interview rubric, coding interview evaluation criteria, coding interview criteria, coding interview grading rubric, technical interview rubric, ] sidebar_label: Coding interview rubrics --- import InDocAd from './\_components/InDocAd'; Ever wondered how coding interviews are evaluated at top tech companies like Google, Amazon, Apple and Netflix? Across top tech companies, coding interview evaluation criteria actually does not differ to a great extent. While the exact terms used in the rubric could be different, the dimensions evaluated are roughly similar. I will go into detail on the general coding interview evaluation process across big tech companies in this guide. I've also included an [example rubric](./coding-interview-rubrics.md) you can use while practicing on your own or with your peers. If you haven't done so already, do refer to my [Coding interview best practices cheatsheet](./coding-interview-cheatsheet.md) which basically synthesizes what candidates should do to fulfill the evaluated criteria in coding interviews. ## Candidate scoring methodology Generally across FAANG / MANGA companies, coding interview evaluation rubrics can be split broadly into 4 dimensions: 1. Communication - Does the candidate make clarifications, communicate their approach and explain while coding? 1. Problem Solving - Does the candidate show they understand the problem and are able to come up with a sound approach, conduct trade-offs analysis and optimize their approach? 1. Technical Competency - How fast and accurate is the implementation? Were there syntax errors? 1. Testing - Was the code tested for common and corner cases? Did they self-correct bugs? There are 2 general methods of candidate scoring in coding interviews: 1. Provide a score (e.g. 1-4) for every dimension and sum them up into an overall score 1. Provide an overall score (e.g. 1-4) based on overall performance across dimensions Regardless of the method used, the scoring bands are generally: - Strong hire - Hire - No hire - Strong no hire Some companies may have a middle band for indecision when the interviewer feels that the candidate requires more assessment. ## How does your score impact the result? Regardless of the scoring methodology, the final score is based on the overall performance across evaluated criteria (not purely through a certain mathematical cut-off). For each phone screen round, there's typically only 1 interviewer, hence if they don't give you a "pass" equivalent to "Leaning hire" and above, you would not proceed to the full interview loop. If there were no clear signals obtained from the round, you might be asked to do a follow up phone screen round. Most top tech companies allow candidates to go through every interview round in the full interview loop before making a decision based on the final package. If a candidate receives mixed results (some "pass" and some "fail") from different rounds, interviewers will convene for a discussion based on the signals you displayed. This is why your performance throughout the interview loop is important. In certain cases, like follow up phone screen rounds, candidates may be invited for additional assessment rounds if: - There were aspects that were missed out in the assessment e.g. 2 coding round interviewers gave very similar questions - Candidate displayed mixed signals in particular areas and additional rounds are required to obtain more reliable signals Generally, your scores and feedback for each round are visible to all interviewers. Sometimes, interviewers can even see feedback from your interviews at the same company in the past to avoid asking the same question again. Companies want to see that you have grown as compared to the past. So if you got rejected in the past by a company, reflect on possible reasons and address them if/when you interview with that company again. ## Detailed explanation of each evaluated criteria ### 1. Communication Basic communication signals: - Asks appropriate clarifying questions - Communicates approach, rationale and tradeoffs - Constantly communicating, even while coding - Well organized, succinct, clear communication | Score | Overall evaluation | | --- | --- | | Strong hire | Throughout the interview, communication was thorough, well-organized, succinct and clear in terms of thought process - including how they understand the question, their approach, trade-offs.
Interviewer had no challenge following and understanding the candidate's thought process at all. | | Leaning hire | Throughout the interview, communication was sufficient, clear and organized.
However, the interviewer had to ask follow-up questions to understand the candidate on certain aspects such as their approach or thought process. | | Leaning no hire | Throughout the interview, communication was (1 or more of the following): (1) Insufficient (e.g. jumped into coding without explaining), (2) Disorganized or unclear
Interviewer had difficulty following the candidate's thought process. | | Strong no hire | Could not communicate with any clarity or stayed silent even when addressed by the interviewer.
Interviewer had extreme difficulty following the candidate's thought process. | ### 2. Problem solving Basic problem solving signals: - Understands the problem quickly by asking good clarifying questions - Approached the problem systematically and logically - Was able to come up with an optimized solution - Determined time and space complexity accurately - Did not require any major hints from the interviewer Advanced problem solving signals: - Came up with multiple solutions - Explained trade-offs of each solution clearly and correctly, concluded on which of them are most suitable for the current scenario - Had time to discuss follow up problems/extensions | Score | Overall evaluation | | --- | --- | | Strong hire | No trouble achieving all basic problem solving signals and did so with enough time to achieve most advanced problem solving signals. | | Leaning hire | Managed to achieve all basic problem solving signals but did not have sufficient time to achieve advanced problem solving signals. | | Leaning no hire | Showed only some basic problem solving signals, failing to achieve the rest. | | Strong no hire | Unable to solve the problem or did it without much explanation of their thought process. Approach was disorganized and incorrect. | ### 3. Technical competency Basic technical competency signals: - Translates discussed solution into working code with minimal to no bugs - Clean and straightforward implementation with no syntax errors and unnecessary code, good coding practices e.g. DRY (Don't repeat yourself), uses proper abstractions - Neat coding style (proper indentation, spacing, variable naming, etc) Advanced technical competency signals: - Compares several coding approaches - Demonstrates strong knowledge of language constructs and paradigms | Score | Overall evaluation | | --- | --- | | Strong hire | Demonstrated basic and advanced competency signals effortlessly. | | Leaning hire | Demonstrated only basic technical competency signals, with some difficulty seen in translating approach to code. Suboptimal usage of language paradigms. | | Leaning no hire | Struggled to produce a working solution in code. Multiple syntax errors and bad use of language paradigms. | | Strong no hire | Could not produce a working solution in code. Major syntax errors and very bad use of language paradigms. | ### 4. Testing Testing signals: - Came up with more typical cases and tested their code against it - Found and handled corner cases - Identified and self-corrected bugs in code - Able to verify correctness of the code in a systematic manner (e.g. acting like a debugger and stepping through each line, updating the program's state at each step) | Score | Overall evaluation | | --- | --- | | Strong hire | Demonstrated testing signals effortlessly. | | Leaning hire | Had some difficulty demonstrating testing signals, such as not being able to identify all the relevant corner cases. | | Leaning no hire | Conducted testing but did not handle corner cases. Not able to identify or correct bugs in code. | | Strong no hire | Did not even test code against typical cases. Did not spot glaring bugs in the code and announced they are done. |
Coding interview evaluation rubric for software engineers
Sample coding interview evaluation rubric, for practice
================================================ FILE: apps/website/contents/coding-interview-study-plan.md ================================================ --- id: coding-interview-study-plan title: Coding interview study plan - what to study and practice based on time left description: Study topics and practice questions based on time left to prepare for Software Engineer coding interviews keywords: [ coding interview study plan, what to study for coding interviews, how to prepare for coding interviews, what practice questions to do for coding interviews, how to prepare for coding interviews in 3 months, ] sidebar_label: Study and practice plan --- import InDocAd from './\_components/InDocAd'; import QuestionList from './\_components/QuestionList'; One of the most important questions to answer at the start of your coding interview preparation is: What study topics and practice questions should you do to most efficiently prepare for your coding interviews? There are plenty of resources on the internet, but it can be hard to know how they fit into the time you have left to prepare. Thankfully, this article will help you with that. I have personally gone through the dreaded Software Engineer interview process myself several times and prepared my own study plans, refining them each time. In this article, I will share the 3 month study plan that I personally use to prepare for my coding interviews. You will find the exact topics to study (with recommended links) and exact questions to practice (with practice links). ## Recommended preparation time and approach How much time do you need to prepare for your coding interviews? Generally, 3 months (if you can dedicate 11 hours a week) is the recommended period of time for a more holistic preparation. I will be sharing recommended study plans for 3 months (recommended period), but you can generate study plans for practice questions for any time frame you need via the Grind 75 tool (built by me). More options like filtering by difficulty, topics, alternative grouping of questions can be found there. Regardless of how long you have, if you are unfamiliar with core data structures and algorithms knowledge, you are advised to revise them before starting on the coding interview questions practice. Different people have different styles of practicing and you should do what works best for you. The various possible approaches are: 1. **Breadth-first preparation** - Revise every topic and then start practicing a variety of questions across all topics. This strategy is recommended if you have around a month to spare. 1. **Depth-first preparation** - Tackle one topic at a time - revise materials for a topic, practice lots of questions for that topic. After ensuring mastery of a topic, move on to the next topic. Repeat for all or selected topics. If you don't have much time, this might be the best way to prepare. You can focus on the High priority topics in our recommended study plan. 1. **Depth-first-then-breadth preparation** - Tackle one topic at a time - revise materials for a topic, practice a few questions for that topic. After ensuring mastery, move on to the next topic. Repeat for all topics. At the end, practice a variety of questions across all topics. This strategy takes more time than others, so it's recommended if you have more than a month. My personal recommendation would be the **Breadth-first preparation** or **Depth-first-then-breadth preparation**. It's important to have some form of breadth-level studying / practicing in your schedule so that you don't forget about the earlier topics as you move on to later topics. ## The 3 month study plan - with recommended study resources and practice question links In each study plan, you will find a list of coding interview topics with resources and practice questions that you should work through **in order of priority** every week. To best utilize it, you should create a template where you break down the dates left and hours left per day, so that you can later fill in the topics/questions to cover per day. Keep the estimate relatively conservative so you don't end up burning out. ### Week 1 - 4: Topical study + practice These are all the topics you should study, in order of priority. The learning resources linked are my algorithm cheatsheets - which give you an overview of must-remembers like time complexity, corner cases, and topic-specific useful techniques, as well as essential and recommended practice questions. Don't forget to apply behaviors from [coding interview best practices](./coding-interview-cheatsheet.md) and methods from [coding interview techniques](./coding-interview-techniques.md) early on while you practice! #### Week 1 | Topic | Priority | Time required | | ---------------------------------------- | -------- | ------------- | | [Array](./algorithms/array.md) | High | 2 hours | | [String](./algorithms/string.md) | High | 3 hours | | [Hash Table](./algorithms/hash-table.md) | Mid | 3 hours | | [Recursion](./algorithms/recursion.md) | Mid | 3 hours | #### Week 2 | Topic | Priority | Time required | | --- | --- | --- | | [Sorting and searching](./algorithms/sorting-searching.md) | High | 3 hours | | [Matrix](./algorithms/matrix.md) | High | 1 hour | | [Linked List](./algorithms/linked-list.md) | Mid | 3 hours | | [Queue](./algorithms/queue.md) | Mid | 2 hours | | [Stack](./algorithms/stack.md) | Mid | 2 hours | #### Week 3 | Topic | Priority | Time required | | ------------------------------ | -------- | ------------- | | [Tree](./algorithms/tree.md) | High | 4 hours | | [Graph](./algorithms/graph.md) | High | 4 hours | | [Heap](./algorithms/heap.md) | Mid | 3 hours | | [Trie](./algorithms/trie.md) | Mid | 3 hours | #### Week 4 | Topic | Priority | Time required | | --- | --- | --- | | [Interval](./algorithms/interval.md) | Mid | 2 hours | | [Dynamic programming](./algorithms/dynamic-programming.md) | Low | 4 hours | | [Binary](./algorithms/binary.md) | Low | 2 hours | | [Math](./algorithms/math.md) | Low | 1 hour | | [Geometry](./algorithms/geometry.md) | Low | 1 hour | ### Week 5 - 12: In-depth practice Here, I listed 75 questions that you should do to be fully prepared for your coding interviews. This list of questions are generated from the [**Grind 75 tool**](https://www.techinterviewhandbook.org/grind75/) (built by me), which generates recommended study plans for coding interviews based on the time you have left. More options like filtering by difficulty, topics, alternative grouping of questions can be found there. - If you followed the Week 1 - 4 study plan, you would have done some of these questions here. Feel free to skip them or do them again. - Feel free to skip the dynamic programming questions if you haven't studied them or feel that they won't be relevant. Many dynamic programming questions can be solved with recursion / backtracking anyway. Don't forget to apply behaviors from [coding interview best practices](./coding-interview-cheatsheet.md) and methods from [coding interview techniques](./coding-interview-techniques.md) early on while you practice! We recommend using the [**Grind 75**](https://www.techinterviewhandbook.org/grind75/) tool which allows you to keep track of your practice progress. ## Factor time for your self introduction, final questions and mock coding interviews Besides studying and practicing for coding interviews, you should also prepare your self introduction, final questions, and try out mock coding interviews. ### Prepare self introduction and final questions to ask I would suggest around 3 hours to craft your self introduction and also prepare some final questions to ask. You may refer to this [self introduction guide](./self-introduction.md) and [final questions to ask guide](./final-questions.md) which should help you complete these steps fairly quickly. ### Schedule mock coding interviews You should start scheduling for mock coding interviews when you are 60% through your coding interview studying and practicing plan. Interview slots are typically provided by interviewers, so you can view them in advance and book them. The platform I have personally used and recommend is [interviewing.io](https://iio.sh/r/DMCa). Read more about [different mock coding interview platforms here](./mock-interviews.md). ================================================ FILE: apps/website/contents/coding-interview-techniques.md ================================================ --- id: coding-interview-techniques title: Top techniques to approach and solve coding interview questions description: Learn methods to find solutions for coding interview problems and optimize their time and space complexity keywords: [ how to approach a coding interview question, how to solve any coding interview question, coding interview practice, coding interview questions, optimize time complexity, optimize space complexity, optimize time and space complexity, ] sidebar_label: Techniques to solve questions --- import InDocAd from './\_components/InDocAd'; The biggest fear most candidates will have during a coding interview is: what if I get stuck on the question and don't know how to do it? Fortunately, there are structured ways to approach coding interview questions that will increase your chances of solving them. From how to find a solution or approach, to optimizing time and space complexity, here are some of the top tips and best practices that will help you solve coding interview questions. ## How to find solutions to coding interview problems When given a coding interview question, candidates should start by asking clarifying questions and discussing a few possible approaches with their interviewers. However, this is where most candidates tend to get stuck. Thankfully, there are ways to do this in a structured manner. Note that not all techniques will apply to every coding interview problem, and you can also use multiple techniques on one single problem! As you apply these techniques during your practice, you will develop the intuition for which technique will be useful for the problem at hand. ### 1. Visualize the problem by drawing it out Ever wondered why coding interviews are traditionally done on whiteboards and videos explaining answers to coding questions tend to use diagrams? Whiteboards make it easy to draw diagrams which helps with problem solving! A huge part of coding is understanding how the internal state of a program changes and diagrams are super useful tools for representing the internal data structures state. If you are having a hard time understanding how the solution is obtained, come up with a visual representation of the problem and if necessary, the internal states at each step. This technique is especially useful if the input involves trees, graphs, matrices, linked lists. #### Example How would you [return all elements of a matrix in spiral order](https://leetcode.com/problems/spiral-matrix/)? Drawing out the matrix and the steps your iterator needs to take in each direction will help tremendously in allowing you to see the pattern. ### 2. Think about how you would solve the problem by hand Solving the problem by hand is about solving the problem without writing any code, like how a non-programmer would. This already happens naturally most of the time when you are trying to understand the example given to you. What some people don't realize is that sometimes a working solution is simply a code version of the manual approach. If you can come up with a concrete set of rules around the approach that works for every example, you can write the code for it. While you might not arrive at the most efficient solution by doing this, it's a start which will give you some credit. #### Example How do you [validate if a tree is a valid Binary Search Tree](https://leetcode.com/problems/validate-binary-search-tree/) without writing any code? You first check if the left subtree contains only values less than the root, then check that the right subtree contains only values bigger than the root, then repeat for each node. This process seems feasible. Now you just have to turn this process into code. ### 3. Come up with more examples Coming up with more examples is something useful you can do regardless of whether you are stuck or not. It helps you to reinforce your understanding of the question, prevents you from prematurely jumping into coding, helps you to identify a pattern which can be generalized to any input, which is the solution! Lastly, the multiple examples can be used as test cases at the end when verifying your solution. ### 4. Break the question down into smaller independent parts If the problem is large, start with a high-level function and break it down into smaller constituting functions, solving each one separately. This prevents you from getting overwhelmed with the details of doing everything at once and keeps your thinking structured. Doing so also makes it clear to the interviewer that you have an approach, even if you don't manage to finish coding all of the smaller functions. #### Example The [Group Anagrams](https://leetcode.com/problems/group-anagrams/) problem can be broken down into two parts - hashing a string, grouping the strings together. Each part can be solved separately with independent implementation details. You could start off with this code: ```py def group_anagrams(strings): def hash(string): # Fill in later pass def group_strings(strings_hashes): # Fill in later pass strings_hashes = [(string, hash(string)) for string in strings] return group_strings(strings_hashes) ``` And proceed to fill in the implementation of each function. However, do note that sometimes the most efficient solutions will require you to break some abstractions and do multiple operations in one pass of the input. If your interviewer asks you to optimize based on your well-abstracted solution, that is one possible path forward. ### 5. Apply common data structures and algorithms at the problem Unlike real-world software engineering where the problems are usually open-ended and might not have clear solutions, coding interview problems tend to be smaller in nature and are designed to be solvable within the duration of the interview. You can also expect that the knowledge required to solve the problem is not out of this world and they would have been taught during college. Thankfully, the number of common data structures and algorithms is finite and a hacky approach which works from my experience is to try going through all the common data structures and applying them to the problem. These are the data structures to keep in mind and try, in order of frequency they appear in coding interview questions: - **Hash Maps**: Useful for making lookup efficient. This is the most common data structure used in interviews and you are guaranteed to have to use it. - **Graphs**: If the data is presented to you as associations between entities, you might be able to model the question as a graph and use some common graph algorithm to solve the problem. - **Stack and Queue**: If you need to parse a string with nested properties (such as a mathematical equation), you will almost definitely need to use stacks. - **Heap**: Question involves scheduling/ordering based on some priority. Also useful for finding the max K/min K/median elements in a set. - **Tree/Trie**: Do you need to store strings in a space-efficient manner and look for the existence of strings (or at least part of them) very quickly? **Routines** - Sorting - Binary search: Useful if the input array is sorted and you need to do faster than O(n) searches - Sliding window - Two pointers - Union find - BFS/DFS - Traverse from the back - Topological Sorting In future we will add tips on how to better identify the most relevant data structures and routines based on the problem. ## How to optimize your approach or solution After you've come up with an initial solution to the coding interview problem, your interviewer would most likely prompt you to optimize the solution by asking "Can we do better". The following techniques help you further optimize the time and space complexity of your solution: ### How to optimize time complexity #### 1. Identify the Best Theoretical Time Complexity of the solution The Best Theoretical Time Complexity (BTTC) of a solution is a time complexity you know that you cannot beat. Some simplified examples: - The BTTC of finding the sum of numbers in array is O(n) because you have to look at every value in the array at least once - The BTTC of finding the [number of groups of anagrams](https://leetcode.com/problems/group-anagrams/) is O(nk) where n is the number of words and k is the maximum number of letters in a word because you have to look at each word at least once and look at each character in each word at least once - The BTTC of finding the number of islands in a matrix is O(nm) where n is the number of rows and m is the number of columns because you have to look at each cell in the matrix at least once Why is it important to know the BTTC? So that you don't go down the rabbit hole of trying to find a solution that is faster than the BTTC. The fastest practical solution can only ever be as fast as the BTTC, not faster than the BTTC. The BTTC is not necessarily achievable in practice (hence theoretical), it just means you can never find a real solution that is faster than it. If your initial solution is slower than the BTTC, there could be opportunities to improve such that you can attain the BTTC (but not always the case). It wouldn't hurt to mention the BTTC to your interviewer, which will be taken as a positive signal and also to remind yourself that you should not try to come up with something faster than the BTTC. Some people might think that the BTTC is simply the total number of elements in a data structure, because you need to go through each element once. This is **not always true**. The most famous example would be finding a number in a sorted array of numbers. The sorted property changes things a whole lot: - Finding a number would be O(log(n)) because you can use a binary search. - Finding the largest number would be O(1) because it is the last value in the array. This is why it is important to pay attention to every detail given about the question. Be careful not to determine the incorrect BTTC due to lack of attention to the question details! With the correct BTTC determined, you now know the time complexity of the optimal solution lies between your initial solution and the BTTC and can work your way towards it. If your solution already has the BTTC and the interviewer is asking you to optimize further, there are usually two things they are looking out for: - Do even less work. Your solution could be O(n) but making two passes of the array and the interviewer is looking for the solution that uses a single pass. - Use less space. Refer to the section below on optimizing space complexity. #### 2. Identify overlapping and repeated computation A naive/brute force solution often executes the same operation over and over again. When the code is doing an expensive operation that has been done before, take a moment to step back and consider if you can reuse results from previous computations. Dynamic programming (DP) is the most obvious type of questions you can entirely leverage past computations. There are non-DP questions that can leverage this technique too, although not as straightforward and might require a preprocessing step. ##### Example The [Product of Array Except Self](https://leetcode.com/problems/product-of-array-except-self/) question is a good example of a problem which contains overlapping/repeated work. To get the value for an index, you need to multiply the values at all other positions. Doing this for every value in the array would take O(n2) time. However, see that: - `result[n]`: `Product(nums[0] … nums[n-1]) * Product(nums[n + 1] … nums[N - 1])` - `result[n + 1]`: `Product(nums[0] … nums[n]) * Product(num[n + 2] … nums[N - 1])` There's a ton of duplicated work in computing the `result[n]` vs `result[n + 1]`! This is an opportunity to reuse earlier computations made while computing `result[n]` to compute `result[n + 1]`. Indeed, we can make use of a prefix array to help us arrive at the final solution in O(n) time at the cost of more space. #### 3. Try different data structures Choice of data structures is key to coding interviews. It can help you to reach a solution for the problem, it can also help you to optimize your existing solution. Sometimes it's worth going through the exercise of iterating through the data structures you know once again. Is lookup time slowing your algorithm down? In general, most lookup operations should be O(1) with the help of a hash table. If the lookup operation in your solution is the bottleneck to your solution's time complexity, more often than not, you can use a hash table to optimize the lookup. ##### Example The [K Closest Points to Origin](https://leetcode.com/problems/k-closest-points-to-origin/) question can be solved in a naive manner by calculating the distance of each point, sorting them and then taking the K smallest values. This takes O(nlog(n)) time because of the sorting. However, by using a Heap data structure, the time complexity can be reduced to O(nlog(k)) as adding/removing from the heap only takes O(log(k)) time when the size of the heap is capped at K elements. Changing the data structure made a whole ton of difference to the efficiency of the algorithm! #### 4. Identify redundant work Here are a few examples of code which is doing redundant work. Although making these mistakes might not change the overall time complexity of your code, you are also evaluated on coding abilities, so it is important to write as efficient code as possible. ##### Don't check conditions unnecessarily These are Python examples where the second check is redundant. - `if not arr and len(arr) == 0` - the first check already ensures that the array is empty so there is no need for the second check. - `x < 5 and x < 10` - the second check is a subcondition of the first check. ##### Mind the order of checks - `if slow() or fast()` - There are two operations in this check, of varying durations. As long as one of the operations evaluates to `true`, the condition will evaluate to `true`. Most computers execute operations in order from left to right, hence it is more efficient to put the `fast()` on the left. - `if likely() and unlikely()` - This example uses a similar argument as above. If we execute `unlikely()` first and it is `false`, we don't have to execute `likely()`. ##### Don't invoke methods unnecessarily If you have to refer to a property multiple times in your function and that property has to be derived from a function call, cache the result as a variable if the value doesn't change throughout the lifetime of the function. The length of the input array is the most common example. Most of the time, the length of the input array doesn't change, declare a variable at the start called `length = len(array)` and use `length` in your function instead of calling `len(array)` every time you need it. ##### Early termination Early termination. Stop after you already have the answer, return the answer immediately. Here's an example of leveraging early termination. Consider this basic question "Determine if an array of strings contain a string regardless of case sensitivity". The code for it: ```py def contains_string(search_term, strings): result = False for string in strings: if string.lower() == search_term.lower(): result = True return result ``` Does this code work? Definitely. Is this code as efficient as it can be? Nope. We only need to know if the search term exists in the array of strings. We can stop iterating as soon as we know that there exists the value. ```py def contains_string(search_term, strings): for string in strings: if string.lower() == search_term.lower(): return True # Stop comparing the rest of the array/list because the result won't change. return False ``` Most people already know this and already do this outside of an interview. However, in a stressful interview environment, people tend to forget the most obvious things. Terminate early from loops where you can. ##### Minimize work inside loops Let's further improve on the example above to solve the question "Determine if an array of strings contain a string regardless of case sensitivity". ```py def contains_string(search_term, strings): for string in strings: if string.lower() == search_term.lower(): return True return False ``` Note that you are calling `search_term.lower()` once per loop of the for loop! It's a waste because the `search_term` doesn't change throughout the lifecycle of the function. ```py def contains_string(search_term, strings): search_term_lowercase = search_term.lower() for string in strings: if string.lower() == search_term_lowercase: return True return False ``` Minimize work inside loops and don't redo work you have already done if it doesn't change. ##### Be lazy Lazy evaluation is an evaluation strategy which delays the evaluation of an expression until its value is needed. Let's use the same example as above. We could technically improve it a little bit: ```py def contains_string(search_term, strings): if len(strings) == 0: return False # Don't have to change the search term to lower case if there are no strings at all. search_term_lowercase = search_term.lower() for string in strings: if string.lower() == search_term_lowercase: return True return False ``` This is considered a micro-optimization and most of the time, `strings` won't be empty, but I'm using it to illustrate the example where you don't have to do certain computations if they aren't needed. This also applies to initialization of objects that you will need in your code (usually hash tables). If the input is empty, there's no need to initialize any variables! ### How to optimize space complexity Most of the time, time complexity is more important than space complexity. But when you have already reached the optimal time complexity, the interviewer might ask you to optimize the space your solution is using (if it is using extra space). Here are some techniques you can use to improve the space complexity of your code. #### 1. Changing data in-place/overwriting input data If your solution contains code to create new data structures to do intermediate processing/caching, memory space is being allocated and can sometimes be seen as a negative. A trick to get around this is by overwriting values in the original input array so that you are not allocating any new space in your code. However, be careful not to destroy the input data in irreversible ways if you need to use it in subsequent parts of your code. A possible way which works (but you should never use outside of coding interviews) is to mutate the original array and use it as a hash table to store intermediate data. Refer to the example below. Note that in Software Engineering, mutating input data is generally frowned upon and makes your code harder to read and maintain, so changing data in-place is mostly something you should do only in coding interviews. #### Example The [Dutch National Flag](https://leetcode.com/problems/sort-colors/) problem could be easily solved with O(n) time and O(n) space by creating a new array and filling it up with the respective values in a sorted fashion. As an added challenge and space optimization, the interviewer will usually ask for an O(n) time and O(1) space solution which involves sorting the input array in-place. An example of using the original array as a hash table is the [First Missing Positive](https://leetcode.com/problems/first-missing-positive/) question. After the first for loop, all the values in the array are positive, and you can indicate presence of a number by negating the value at the index corresponding to the number. To indicate 4 is present, negate `nums[4]`. #### 2. Change a data structure Data structures again!? Yes, data structures again! Data structures are so fundamental to coding interviews and mastery of it makes or breaks your interview performance. Are you using the best data structure possible for the problem? #### Example You're given a list of strings and want to find how many of these strings start with a certain prefix. What's an efficient way to store the strings so that you can compute your answer quickly? A [Trie](https://leetcode.com/problems/implement-trie-prefix-tree/) is a tree-like data structure that is very efficient for storing strings and also allows you to quickly compute how many strings start with a prefix. ## Next Steps If you haven't already, I recommend you check out my [free structured guide for coding interviews](./software-engineering-interview-guide.md), which contains step by step guidance such as: - [How to make an efficient plan for your coding interview preparation](./coding-interview-study-plan.md) - including priority of topics and questions to study, based on the time you have left - [Coding interview best practices cheatsheet](./coding-interview-cheatsheet.md) - including how to behave during a coding interview to exhibit hire signals - [Algorithms cheatsheets](./algorithms/study-cheatsheet.md) - including the must-remembers that you should internalize for every data structure ================================================ FILE: apps/website/contents/engineering-levels.md ================================================ --- id: engineering-levels title: 🎚 Engineering levels --- Understanding the various career levels for engineers is crucial because it helps to determine the compensation you should be receiving and also helps you to understand what is expected of you at that level. In most companies where the career levels have been defined, it would resemble something along the lines of: Junior → Software Engineer → Senior → Staff → Senior Staff → Principal → Distinguished ## Career levels The software engineering levels you've listed typically exist in many technology companies, and the specific responsibilities, years of experience, and other relevant factors can vary from company to company. However, I can provide a general overview of what each of these roles typically entails: ### Junior Software Engineer - **Description**: Entry-level role focused on learning and gaining practical experience. - **Influence**: Individual - **Scope of work**: Task-level. - **Responsibilities**: Writing code, debugging, testing, and collaborating with team members. Often working on well-defined tasks and projects under the guidance of more experienced engineers. - **Experience**: Typically 0-2 years of experience, recent graduates or individuals in the early stages of their career. ### Software Engineer - **Description**: Mid-level role with a broader range of responsibilities and more independence. - **Influence**: Individual / Team - **Scope of work**: Features / small projects. - **Responsibilities**: Designing, implementing, and maintaining software solutions. Collaborating with cross-functional teams, participating in code reviews, and contributing to the development process. - **Experience**: Typically 2-5 years of experience, depending on the company and individual progression. ### Senior Software Engineer - **Description**: Experienced individual contributor with a deeper technical understanding. - **Influence**: Team - **Scope of work**: Large features / multiple small projects. - **Responsibilities**: Leading complex technical projects, mentoring junior engineers, making architectural decisions, and contributing to the overall software design and development process. - **Experience**: Typically 5+ years of experience, often with a track record of successfully delivering significant software projects. ### Staff Software Engineer - **Description**: Highly skilled individual contributor with expertise in specific domains or technologies. - **Influence**: Large team / Area (multiple/neighboring teams) - **Scope of work**: Larger projects spanning multiple halves. - **Responsibilities**: Taking ownership of critical technical components, providing technical leadership, and guiding the architectural direction of projects. May also serve as a technical advisor to other teams. - **Experience**: Typically 10+ years of experience, with a strong technical background. ### Senior Staff Software Engineer - **Description**: A more advanced version of the Staff Software Engineer role. - **Influence**: Organization / Company - **Scope of work**: Larger projects spanning multiple halves/years that are crucial to the organization. - **Responsibilities**: Leading major technical initiatives, setting technical strategy, and providing mentorship and guidance to multiple teams. May have a significant impact on the company's technical direction. - **Experience**: Typically 15+ years of experience, with a proven track record of delivering complex projects. ### Principal Software Engineer - **Description**: Recognized technical leader with deep expertise in one or more areas. - **Influence**: Company / Industry - **Scope of work**: Large projects spanning multiple halves/years affecting the entire company. - **Responsibilities**: Defining and driving the technical vision for the company or specific projects, leading architectural decisions, and often acting as a technical authority. - **Experience**: Most engineers do not reach this level. Requires a strong record of technical innovation and leadership. ### Distinguished Engineer and beyond - **Description**: The highest individual contributor role in many organizations, often one of the most respected technical experts and the pinnacle of a technical career within a company. - **Influence**: Industry - **Scope of work**: Huge projects spanning multiple halves/years that affect the entire company or even the industry. - **Responsibilities**: Setting the highest-level technical strategy, influencing industry standards, and serving as a technical advisor to the company's leadership and even moving the industry forward. Can represent the company in industry forums and standards bodies. - **Experience**: Most engineers do not reach this level. Requires a long history of significant technical excellence, innovation, leadership and industry recognition. They are recognized as experts not only within their organization but also in the broader industry. These roles can vary widely between companies, and some organizations may have additional levels or different titles. Additionally, soft skills, leadership abilities, and contributions to the company's culture and goals also play a significant role in career progression beyond just technical expertise. #### References - [Software Engineering Salaries at Google](https://careerkarma.com/blog/software-engineering-salary-google/) - [Dropbox Engineering Career Framework](https://dropbox.github.io/dbx-career-framework/overview.html) - [Engineering Levels at SoundCloud](https://developers.soundcloud.com/blog/engineering-levels/) - [Every Public Engineering Career Ladder](https://www.swyx.io/career-ladders) - [progression.fyi](https://progression.fyi/) ================================================ FILE: apps/website/contents/final-questions.md ================================================ --- id: final-questions title: 'Software Engineer interviews: Best end of interview questions to ask' description: The best questions to ask the interviewer at the end of a Software Engineer interview to leave a good impression keywords: [ questions to ask at the end of an interview software engineer, questions to ask software engineer interview, software engineer questions to ask interviewer, software engineer interview questions to ask, ] sidebar_label: Preparing final questions to ask --- import InDocAd from './\_components/InDocAd'; Something you can always count on to happen at the end of your Software Engineer interview - both technical and non-technical rounds - is for the interviewer to ask you if you "have any final questions?". This question actually isn't a real question at all - candidates are generally expected to ask questions. As an interviewer myself, candidates who don't have any questions might come off as less interested in the role. Besides that, the questions you ask reveal what you care about. If asked well, this can be a very predictable opportunity for you to leave a good impression while also knowing more about the role (including uncovering potential red flags). Here, I present questions to ask at the end of your software engineer interviews, for every purpose. The ones in **bold** are the ones that tend to make the interviewer go "That's a good question" and pause and think for a bit. ## Best questions to ask for knowing more about technical work - **What are the engineering challenges that the company/team is facing?** - **What has been the worst technical blunder that has happened in the recent past? How did you guys deal with it? What changes were implemented afterwards to make sure it didn't happen again?** - **What is the most costly technical decision made early on that the company is living with now?** - **What is the most fulfilling/exciting/technically complex project that you've worked on here so far?** - **I do/don't have experience in domain X. How important is this for me to be able to succeed?** - How do you evaluate new technologies? Who makes the final decisions? - How do you know what to work on each day? - How would you describe your engineering culture? - How has your role changed since joining the company? - What is your stack? What is the rationale for/story behind this specific stack? - Do you tend to roll your own solutions more often or rely on third party tools? What's the rationale in a specific case? - How does the engineering team balance resources between feature requests and engineering maintenance? - What do you measure? What are your most important product metrics? - How often have you moved teams? What made you join the team you're on right now? If you wanted to move teams, what would need to happen? - What resources does the company have for new hires to study its product and processes? Are there specifications, requirements, documentation? - How do you think my expertise would be relevant to this team? What unique value can I add? ## Best questions to ask for knowing more about the role - **What qualities do you look out for when hiring for this role?** - **What would be the most important problem you would want me to solve if I joined your team?** - What does a typical day look like in this role? - What are the strengths and weaknesses of the current team? What is being done to improve upon the weaknesses? - What resources does the company have for new hires to study its product and processes? Are there specifications, requirements, documentation? - What would I work on if I joined this team and who would I work most closely with? ## Best questions to ask for knowing more culture and welfare - **What is the most frustrating part about working here?** - **What is unique about working at this company that you have not experienced elsewhere?** - **What is something you wish were different about your job?** - How is individual performance measured? - What do you like about working here? - What is your policy on working from home/remotely? - What does the company do to nurture and train its employees? - Does the company culture encourage entrepreneurship and creativity? Could you give me any specific examples? ## Best questions to ask to know more about team leadership or management These questions are suitable for asking Engineering Managers or senior level management, such as CEO, CTO, VPs and are especially useful for the Team Matching phase of Google interviews or post-offer calls that your recruiters set up with the various team managers. - **How do you train/ramp up engineers who are new to the team?** - **What does success look like for your team/project?** - **What are the strengths and weaknesses of the current team? What is being done to improve upon the weaknesses?** - **Can you tell me about a time you resolved an interpersonal conflict?** - How did you become a manager? - How do your engineers know what to work on each day? - What is your team's biggest challenge right now? - How do you measure individual performance? - How often are 1:1s conducted? - What is the current team composition like? - What opportunities are available to switch roles? How does this work? - Two senior team members disagree over a technical issue. How do you handle it? - Have you managed a poor performer at some point in your career before? What did you do and how did it work? - Where do you spend more of your time, high performers or low performers? - Sometimes there's a trade-off between what's best for one of your team members and what's best for the team. Give an example of how you handled this and why. - Give an example of a time you faced a difficult mentoring/coaching challenge. What did you do and why? - What is your management philosophy? - What is the role of data and metrics in managing a team like ours? - What role does the manager play in making technical decisions? - What is an example of a change you have made in the team that improved the team? - What would be the most important problem you would want me to solve if I joined your team? - What opportunities for growth will your team provide? - What would I work on if I joined this team and who would I work most closely with? ## Best questions to ask to know more about company direction - **How does the company decide on what to work on next?** - What assurance do you have that this company will be successful? - Which companies are your main competitors and what differentiates your company? - What are your highest priorities right now? For example, new features, new products, solidifying existing code, reducing operations overhead? ================================================ FILE: apps/website/contents/interview-formats-top-companies.md ================================================ --- id: interview-formats-top-companies title: Interview format at top companies description: Interview formats of the top tech companies. Know what to expect and prepare well for them sidebar_label: 💼 Company interview formats --- import InDocAd from './\_components/InDocAd'; :::info Due to COVID travel restrictions, many companies hold interviews remotely even for the onsite rounds, so the instructions might differ. ::: Are there companies you would like to know more about? Email us at [contact{at}techinterviewhandbook.org](mailto:contact@techinterviewhandbook.org). ## Airbnb - Recruiter phone screen - Technical phone interview: - 1 or 2 x Algorithm/front end on CoderPad/CodePen - Onsite (General): - 2 x Algorithm coding on CoderPad - 1 x System Design/architecture - 1 x Past experience/project - 2 x Cross functional - Onsite (Front End): - 2 x Front end coding on CodePen. Use any framework/library - 1 x General coding on your own laptop - 1 x Past experience/project - 2 x Cross functional - Tips: - All sessions involve coding on your own laptop. Prepare your development environment in advance - You are allowed to look up APIs if you need to - They seem to place high emphasis on compilable, runnable code in all their coding rounds - Cross functional interviews will involve getting Airbnb employees from any discipline to speak with you. These interviews are mostly non-technical but are extremely important to Airbnb because they place a high emphasis on cultural fit. Do look up the Airbnb section of the behavioral questions to know what sort of questions to expect ## Asana - Recruiter phone screen - Technical phone interview - Onsite (Product Engineer): - 3 x Algorithm and System Design on whiteboard within the same session - 1 x Algorithm on laptop and System Design. This session involves writing code on your own laptop to solve 3 well-defined algorithm problems in around 45 minutes after which an engineer will come in and review the code with you. You are not supposed to run the code while working on the problem - Tips: - No front end questions were asked - Asana places high emphasis on System Design and makes heavy use of the whiteboard. You do not necessarily have to write code for the algorithm question of the first three interviews - All 4 sessions involve algorithms and System Design. One of the sessions will be conducted by an Engineering Manager - The last session will involve coding on your own laptop. Prepare your development environment in advance - Regardless of Product Engineer or Engineering Generalist position, their interview format and questions are similar ## Dropbox - Recruiter phone screen - Technical phone interviews: - 2 x Algorithm/front end on CoderPad/CodePen - Onsite (Front End): - 2 x Front end on CodePen. Only Vanilla JS or jQuery allowed - 1 x General coding on CoderPad - 1 x All around. Meet with an Engineering Manager and discussing past experiences and working style - Tips: - You can code on your own laptop and look up APIs - Dropbox recruiters are very nice and will give you helpful information on what kind of questions to expect for the upcoming sessions - One of the front end sessions involve coding up a pixel-perfect version of a real page on the Dropbox website. You'll be given a spec of the desired page and you'll be asked to create a working version during the interview ## Google - Recruiter phone screen - Technical phone interview: - 1 or 2 x Algorithm on Google Doc - Onsite: - 1 or 2 x Front end on whiteboard. May be required to use Vanilla JS (or at the most, jQuery) depending on the question. (Front End only) - 2 to 4 x Algorithm on whiteboard - 1 x General Cognitive Ability, Leadership and "Googleyness". - Team matching - Speak with managers from different teams who are interested in your profile - Tips: - In rare cases, candidates may even be allowed to skip the phone interview round and advanced to onsite directly - For non-fresh grads, you only receive an offer if you are successfully matched with a team ## Indeed - Recruiter phone screen - Technical phone interview (optional) - Onsite: - 1 x Online Assessment on HackerRank (for L0 - L2) - 1 x Resume discussion - 1 or 2 x Algorithm on HackerRank - 1 x Code Review on GitHub - 1 or 2 x System Design (for L3+) - 1 x Technical Presentation (for L4+) - Tips: - If you are interviewing for a specific role, the bar varies - Hiring decision and leveling are separate discussions; leveling is determined by experience and leadership signals - If you do well in the interviews but the position is already filled, other hiring managers can pick up your packet ## Lyft - Recruiter phone screen - Technical phone interview: - 1 x Algorithm/Front end over JSFiddle - Onsite (Front End): - 4 x Front end on Coderpad/your own laptop. Use any language/framework - 1 x Behavioral. Meet with an Engineering Manager and go through candidate's resume - Tips: - Can use whiteboard and/or laptop - For front end coding, I opted to use React and had to set up the projects on the spot using `create-react-app` ## Meta (previously Facebook) - Recruiter phone screen - Technical phone interviews: - 1 or 2 x Algorithm/front end on Skype/CoderPad - Onsite: - 2 x Technical coding interview on whiteboard - 1 x Behavioral. Meet with an Engineering Manager and discussing past experiences and working style - 1 x Design/architecture on whiteboard - Onsite (University Grad): - 2 x Technical coding interview on whiteboard - 1 x Behavioral. Meet with an Engineering Manager and discussing past experiences and working style - Tips: - You are only allowed to use the whiteboard (or wall). No laptops involved - For the behavioral round, you may be asked a technical question at the end of it. Front end candidates will be given a small HTML/CSS problem nearing the end of the session - For the coding rounds, you may be asked one or more questions depending on how fast you progress through the question ## Palantir - Recruiter phone screen - Technical phone interview: - 1 x Algorithm over HackerRank CodePair and Skype - Onsite (General): - 2 x Algorithm on whiteboard - 1 x Decomposition (System Design) on whiteboard - Onsite (Front End): - 1 x Front end on your own laptop. This session lasts about 1.5 hours. Use any library/framework - 1 x Decomposition (System Design) on whiteboard - Tips: - I opted to use React and had to set up projects on the spot using `create-react-app` - You may be asked to meet with Engineering Managers after the technical sessions and it's not necessarily a good/bad thing ## WhatsApp - Recruiter phone screen - Technical phone interview: - 2 x Algorithm over CoderPad - Onsite (Web Client Developer): - 4 x Algorithm on whiteboard - Tips: - No front end questions were asked - 1 of the interviewers is an Engineering Manager ================================================ FILE: apps/website/contents/interviewer-cheatsheet.md ================================================ --- id: interviewer-cheatsheet title: 👩‍💻 Cheatsheet (Interviewer) --- This is a straight-to-the-point, distilled list of technical interview Do's and Don'ts **for interviewers**, mainly for algorithmic interviews. Some of these may apply to only phone screens or whiteboard interviews, but most will apply to both. I revise this list before each of my interviews as an interviewer to remind myself of them and eventually internalized all of them to the point I do not have to rely on it anymore. :::caution If you are an interview candidate, this page is not crucial for you. However, having an understanding of what interviewers look out for can be helpful to you! ::: #### Legend - ✅ = Do - ❌ = Don't - ⚠️ = Situational ### Before interview | | Things | | --- | --- | | ✅ | Make sure your surroundings are well-lit. | | ✅ | Find a quiet environment with good Internet connection. | | ✅ | Ensure webcam and audio are working. Test that your VC app is working well. | | ✅ | Prepare two to three questions and be familiar with the different approaches for solving the questions. Good questions have multiple solutions each with different tradeoffs. | | ✅ | Choose questions from different topics to identify possible knowledge gaps. | | ✅ | Familiarize yourself with the coding environment (CoderPad/CodePen). Set up the coding shortcuts, turn on autocompletion, tab spacing, etc. | ### Introduction | | Things | | --- | --- | | ✅ | Check if candidate wants to use the restroom or take a break. | | ✅ | Give an overview of the interview format (introduction, duration, programming languages available, 5 min at the end for Q&A). | | ✅ | Do a self-introduction and get the candidate to introduce themselves. | | ✅ | Explain to candidate that there will be multiple questions (where relevant), they do not have to finish all questions and you might interrupt them abruptly. | | ❌ | Allow the candidate to spend too long introducing themselves. | ### Upon delivering the question | | Things | | --- | --- | | ✅ | Ask if the candidate has seen the question before. | | ✅ | Give a small example for the question and the desired output. | | ✅ | Get the candidate to talk through the solution first before diving into coding. | | ✅ | Provide hints where appropriate. | | ✅ | If candidate is still stuck after providing hints, provide the solution and move to coding so that you can get coding signals. | ### During coding | | Things | | --- | --- | | ✅ | If whiteboard interview, stand alongside candidate but also giving them space, instead of being distant, e.g. seated down. | | ✅ | Take note of all the [positive and negative signals](./coding-interview-rubrics.md). | | ✅ | If you have multiple questions, don't let the candidate spend too long on one question, especially if the first question is an Easy one. | | ❌ | Check the time in an overly-obvious manner. | ### After coding | | Things | | --- | --- | | ✅ | Ask for candidate to provide test cases and run through the code with them. | | ✅ | Identify edge cases the candidate missed and ask the candidate to address them. Ask the candidate "What if X was the input? What would your code produce?" instead of pointing the issue out directly. | | ✅ | Take note of the duration the candidate spent on each question to include in the feedback. | | ✅ | Ask for time complexity and space analysis. | | ✅ | Preserve the code somewhere - take a picture or copy the code out. | | ✅ | Stop the candidate when there is 5 minutes left. e.g. ("I'll stop you here and let's go to the next section") | ### Wrap up | | Things | | --- | --- | | ✅ | Allow candidate to ask questions and answer them to the best of your ability. | | ✅ | Thank the candidate and wish them all the best. | ### Post interview | | Things | | --- | --------------------------------------------------------- | | ✅ | Write feedback as soon as possible to not forget details. | ================================================ FILE: apps/website/contents/landscape.md ================================================ --- id: landscape title: 🏔 Landscape --- import InDocAd from './\_components/InDocAd'; import InternshipSalariesURL from '@site/static/img/internship-salaries.jpg'; Most of the content covered here will be specific to the Bay Area. Landscape differences due to geographical location are mentioned briefly [below](#geographical-location). ## Career prospects as a Software Engineer ### High demand Almost every domain leverages on technology, hence Software Engineers are needed in almost every industry. Demand for engineers is higher than supply, leading to generally high-paying jobs. Moreover, the demand is continuously growing. ### Stable career Computer Science is rapidly gaining popularity and engineering is a highly-regarded professional career. Unlike the creative industry, you do not have to be the top 1% of the industry to lead a comfortable life. An engineer fresh out of college working at a Silicon Valley company (both large companies and startups) can expect to receive a starting salary of more than USD 100,000 and it just gets better from there. ### Requires lifelong learning Technology industry is an extremely fast-moving one. Many technologies used today didn't even exist/were popular a decade ago; in 2009, mobile app development and blockchain were pretty much unheard of. Engineers need to constantly upgrade their skills to stay relevant to the demands of the job market. Engineering is a great career for passionate individuals who like to learn. ### Flexible A software engineering job is perhaps the most flexible job that exists in terms of hours, location and environment. Physical location is usually not an issue and there are many tech companies that are fully remote. There's no formal attire to be worn and working hours are generally flexible. Your co-workers would stare at you weirdly if you came to work wearing a shirt and tie. ## Internships vs full-time If you dream of working at a top tech company one day, getting hired via an intern conversion is by far the easiest way to achieve that. Internship interviews are extremely short (usually just 2 rounds whereas interviews for full-time roles are usually 4-5 rounds). Internships allow you to work at a company over a short period of time (3 months or so) and helps in getting a first-hand understanding of the company and engineering culture. Companies also tend to give higher return job offers to high performing interns as they have proven to be effective at the job and can work with existing employees; hence hiring them is considered to be relatively low-risk. Top tech companies pay a ridiculous amount even for junior candidates: ### United States
Salaries of top tech internships in 2016
Salaries of top US tech internships in 2016 ([source](https://twitter.com/rodneyfolz/status/724787290824798209))
### Singapore We ran a survey to find out what the famous tech companies in Singapore are paying new hires in 2022/2023, and here's a sample of the results: | Company | Internship (monthly in SGD) | Fresh Grad Annual Total (SGD) | | ------------- | --------------------------- | ----------------------------- | | Stripe | $6000 | $150,000 | | Meta/Facebook | $6000 | $140,000 | | Google | $5400 | $110,000 | | Shopee | $4200 | $100,000 - $140,000 | | ByteDance | $4000 | $90,000 - $100,000 | | Grab | $2500 | No data | | Visa | $2200 | $110,000 | _Note: Fresh grad annual total numbers are approximate and include base salary, stock, and target bonuses._ ## Company size Companies have different focuses depending on the stage they are at and the types of work to be done can also be vastly different. In the earlier stages where product-market fit hasn't been found, companies would be rapidly iterating on products and features, whereas larger companies that have already found the right product will focus on scaling their infrastructure and growing their users. Liquid compensation is also lower at early-stage companies due to the equity not being worth any money, but there is the chance of earning a lot more if/when the company IPOs or gets acquired. | Dimension | Early-stage startup | Late-stage startup | Large company | | --- | --- | --- | --- | | Company size | <100 | 100-1000 | >1000 | | Compensation | Base salary is a bit higher than big companies. Higher equity amount but its value is hard to judge as the company's valuation is unclear and stocks are not worth money yet. High risk, high return. | Base salary is a bit higher than big companies. Company valuation is clearer and stocks have higher chance of being worth money. | Depends on the prestige of the company. Compensation is usually market standard or better. Stocks are worth money if company has gone public. | | Types of work | Mainly product development. Engineers have to wear multiple hats - Front End, Back End, DevOps, Design, etc. | Product development and some infra. | Diverse roles and specialized work; dedicated people for each role. Infra and prod infra work is more common. More opportunities for internal transfers, sometimes even across the globe. | | Career ladder | Unstructured. No (or very vague) career levels. Not much formal mentorship nor training. | Somewhat structured. | Very structured. Well-defined career levels. | | Iteration speed | Extremely fast. Struggling to find product market fit. | Moderate. Has found product market fit, trying to grow user base. | Stable product with wide user base. Incrementally roll out changes and do lots of experimentation. | _It's important to note that the above are just general trends and exceptions can apply._ ## Geographical location | | US (Silicon Valley/NY) | Singapore | | --- | --- | --- | | Starting Pay | USD 100,000 | Monthly $6000 (Median), $6900 (75th percentile) | | Talent Access | Global talent, diverse nationalities and backgrounds | Usually regional, mostly Asians | | Types of Companies | HQ of large companies (Facebook, Amazon, Apple, Google, Microsoft, etc), Startups | Branch offices of large companies, Startups | | Types of Engineering Work | Depends on size of office/company | Both product and infra (building new programming languages, frameworks, and tools) | _Singapore salary data taken from [NUS GES 2021](https://www.moe.gov.sg/-/media/files/post-secondary/ges-2021/web-publication-nus-ges-2021.pdf)._ ================================================ FILE: apps/website/contents/mock-interviews.md ================================================ --- id: mock-interviews title: Best mock coding interview platforms for Software Engineers description: Review of top mock interview platforms for Software Engineer coding interviews keywords: [ mock interview, best mock interview platforms, best mock coding interview platforms, best sites to use for mock coding interviews, interviewing.io review, pramp review, coding mock interview, mock tech interview, ] sidebar_label: Mock coding interviews --- Interviewing is a skill that you can get better at. The steps mentioned above can be rehearsed over and over again until you have fully internalized them and following those steps become second nature to you. A good way to practice is to find a friend to partner with and the both of you can take turns to interview each other. ## [interviewing.io](https://iio.sh/r/DMCa) A great resource for practicing mock coding interviews would be [interviewing.io](https://iio.sh/r/DMCa). [interviewing.io](https://iio.sh/r/DMCa) provides anonymous practice technical interviews with Google and Facebook engineers, which can lead to real jobs and internships. By virtue of being anonymous during the interview, the inclusive interview process is de-biased and low risk. At the end of the interview, both interviewer and interviewees can provide feedback to each other for the purpose of improvement. Doing well in your mock interviews will unlock the jobs page and allow candidates to book interviews (also anonymously) with top companies like Uber, Lyft, Quora, Asana and more. You can also book mock interviews for more specific roles such as Mobile, Front End, Engineering Management. For those who are totally new to technical interviews, you can even view [recorded interviews](https://interviewing.io/mocks) and see how phone interviews are like. Read more about them [here](https://techcrunch.com/2017/09/27/interviewing-io-hopes-to-close-the-engineer-diversity-gap-with-anonymous-interviews/). I have used [interviewing.io](https://iio.sh/r/DMCa) both as an interviewer and an interviewee and found the experience to be really great! [Aline Lerner](https://twitter.com/alinelernerLLC), the CEO and co-founder of [interviewing.io](https://iio.sh/r/DMCa) and her team are passionate about revolutionizing the technical interview process and helping candidates to improve their skills at interviewing. She has also published a number of technical interview-related articles on the [interviewing.io blog](https://interviewing.io/blog). ## Pramp Another platform that allows you to practice coding interviews is [Pramp](https://www.pramp.com/). Where [interviewing.io](https://iio.sh/r/DMCa) matches potential job seekers with seasoned technical interviewers, Pramp takes a different approach. Pramp pairs you up with another peer who is also a job seeker and both of you take turns to assume the role of interviewer and interviewee. Pramp also prepares questions for you, along with suggested solutions and prompts to guide the interviewee. Personally, I am not that fond of Pramp's approach because if I were to interview someone, I would rather choose a question I am familiar with. Also, many users of the platform do not have the experience of being interviewers and that can result in a horrible interview experience. There was once where my matched peer, as the interviewer, did not have the right understanding of the question and attempted to lead me down the wrong path of solving the question. However, this is more of a problem of the candidate than the platform though. ## [Hello Interview](https://www.hellointerview.com/?utm_source=techinterviewhandbook) **Disclaimer: This section was added by the Hello Interview team** Hello Interview uses a combination of AI and expert FAANG staff engineers and managers to help you prepare for your interview. Practice with AI at your own pace on system design, behavioral, or coding interviews. Schedule mock interviews with a human for detailed, 360 degree feedback on all aspects of your interview from domain knowledge and techniques to presentation skills and communication. Hello Interview offers included services from resume reviews to salary negotiation and offer decision support ensuring you're able to minimize the time spent preparing and maximize the result of your interview journey. ## [Meetapro](https://www.meetapro.com/?utm_source=techinterviewhandbook) **Disclaimer: This section was added by the Meetapro team** Envision Meetapro as the Airbnb for mock interviews and career coaching. It connects job seekers with seasoned FAANG interviewers who provide invaluable feedback, getting you ready for real-life interviews. Numerous job seekers have already reaped the benefits of this platform. What makes Meetapro stand out? - Affordability: The average cost per session is significantly lower compared to other platforms. - Expert interviewers: Veterans from FAANG and top-tier companies bring years of experience, offering priceless feedback that truly makes a difference. - Direct communication: Job seekers can directly message interviewers to address any questions or concerns, such as experience sharing or rescheduling, ensuring better preparation for both parties. - All-in-one tools: Meetapro equips you with the essential tools for an effective interview session, including recording options for post-session review. ## [Codemia](https://codemia.io/?utm_source=techinterviewhandbook) **Disclaimer: This section was added by the Codemia team** Codemia harnesses the power of advanced AI technology to evaluate and score your solutions instantly, enabling iterative practice and rapid skill refinement. But Codemia isn't just about practicing in isolation; it's a thriving community where members collaborate, share insights, and provide valuable feedback to one another, fostering a collaborative learning environment unlike any other. With a practice environment reminiscent of the familiar setup of LeetCode for algorithm challenges, Codemia offers a realistic simulation of interview scenarios, ensuring you're fully prepared to tackle any system design question with confidence. ================================================ FILE: apps/website/contents/negotiation-rules.md ================================================ --- id: negotiation-rules title: Ten rules of negotiation description: Learn the basic rules of negotiation keywords: [ FAANG, tech, jobs, negotiation, tips, software engineer, offer, total compensation, salary, ] --- import InDocAd from './\_components/InDocAd'; Key points extracted from "Ten Rules for Negotiating a Job Offer" [Part 1](https://haseebq.com/my-ten-rules-for-negotiating-a-job-offer/) and [Part 2](https://haseebq.com/how-not-to-bomb-your-offer-negotiation/) by Haseeb Qureshi. ## Get everything in writing Note down EVERYTHING on your phone call with the recruiters as they may be helpful later on. Even if there are things that are not directly monetary, if they relate to the job, write them down. If they tell you "we're working on porting the front-end to Angular," write that down. If they say they have 20 employees, write that down. You want as much information as you can. You'll forget a lot of this stuff, and it's going to be important in informing your final decision. ## Always keep the door open Never give up your negotiating power until you're absolutely ready to make an informed, deliberate final decision. This means your job is to traverse as many of these decision points as possible without giving up the power to continue negotiating. Very frequently, your interlocutor will try to trick you into making a decision, or tie you to a decision you didn't commit to. You must keep verbally jiu-jitsu-ing out of these antics until you're actually ready to make your final decision. ## Information is power To protect your power in the negotiation, you must protect information as much as possible. A corollary of this rule is that you should not reveal to companies what you're currently making. So given this offer, don't ask for more money or equity or anything of the sort. Don't comment on any specific details of the offer except to clarify them. Companies will ask about your current compensation at different stages in the process—some before they ever interview you, some after they decide to make you an offer. But be mindful of this, and protect information. > "Yeah, [COMPANY_NAME] sounds great! I really thought this was a good fit, and I'm glad that you guys agree. Right now I'm talking with a few other companies so I can't speak to the specific details of the offer until I'm done with the process and get closer to making a decision. But I'm sure we'll be able to find a package that we're both happy with, because I really would love to be a part of the team." ## Always be positive Even if the offer is bad, it's extremely important to remain positive and excited about the company. This is because your excitement is one of your most valuable assets in a negotiation. Despite whatever is happening in the negotiation, give the company the impression that 1) you still like the company, and that 2) you're still excited to work there, even if the numbers or the money or the timing is not working out. Generally the most convincing thing to signal this is to reiterate you love the mission, the team, or the problem they're working on, and really want to see things work out. ## Don't be the decision maker Even if you don't particularly care what your friends/family/husband/mother thinks, by mentioning them, you're no longer the only person the recruiter needs to win over. There's no point in them trying to bully and intimidate you; the "true decision-maker" is beyond their reach. This is a classic technique in customer support and remediation. It's never the person on the phone's fault, they're just some poor schmuck doing their job. It's not their decision to make. This helps to defuse tension and give them more control of the situation. > I'll look over some of these details and discuss it with my [FAMILY/CLOSE_FRIENDS/SIGNIFICANT_OTHER]. I'll reach out to you if I have any questions. Thanks so much for sharing the good news with me, and I'll be in touch! It's much harder to pressure someone if they're not the final decision-maker. So take advantage of that. ## Have alternatives If you're already in the pipeline with other companies (which you should be if you're doing it right), you should proactively reach out and let them know that you've just received an offer. Try to build a sense of urgency. Regardless of whether you know the expiration date, all offers expire at some point, so take advantage of that. > Hello [PERSON], > > I just wanted to update you on my own process. I've just received an offer from [COMPANY] which is quite strong. That said, I'm really excited about [YOUR AMAZING COMPANY] and really want to see if we can make it work. Since my timeline is now compressed, is there anything you can do to expedite the process? Should you specifically mention the company that gave you an offer? Depends. If it's a well-known company or a competitor, then definitely mention it. If it's a no-name or unsexy company, you should just say you received an offer. If it's expiring soon, you should mention that as well. Either way, send out a letter like this to every single company you're talking to. No matter how hopeless or pointless you think your application is, you want to send this signal to everyone who is considering you in the market. Companies care that you've received other offers. They care because each company knows that their own process is noisy, and the processes of most other companies are also noisy. But a candidate having multiple offers means that they have multiple weak signals in their favor. Combined, these converge into a much stronger signal than any single interview. It's like knowing that a student has a strong SAT score, and GPA, and won various scholarships. Sure, it's still possible that they're a dunce, but it's much harder for that to be true. This is not to say that companies respond proportionally to these signals, or that they don't overvalue credentials and brands. They do. But caring about whether you have other offers and valuing you accordingly is completely rational. Tell other companies that you've received offers. Give them more signals so that they know you're a valued and compelling candidate. And understand why this changes their mind about whether to interview you. Your goal should be to have as many offers overlapping at the same time as possible. This will maximize your window for negotiating. Have a strong BATNA (Best Alternative To a Negotiated Agreement) and communicate it. > I 've received another offer from [OTHER CORP] that's very compelling on salary, but I really love the mission of [YOUR COMPANY] and think that it would overall be a better fit for me. > I'm also considering going back to grad school and getting a Master's degree in Postmodern Haberdashery. I'm excited about [YOUR COMPANY] though and would love to join the team, but the package has to make sense if I'm going to forego a life of ironic hatmaking. ## Proclaim reasons for everything It's kind of a brain-hack, both for yourself and for your negotiating partner. Just stating a reason (any reason) makes your request feel human and important. It's not you being greedy, it's you trying to fulfill your goals. The more unobjectionable and sympathetic your reason, the better. If it's medical expenses, or paying off student loans, or taking care of family, you'll bring tears to their eyes. Just go with it, state a reason for everything, and you'll find recruiters more willing to become your advocate. ## Be motivated by more than just money You should be motivated by money too of course, but it should be one among many dimensions you're optimizing for. How much training you get, what your first project will be, which team you join, or even who your mentor will be—these are all things you can and should negotiate. Of course, to negotiate well you need to understand the other side's preferences. You want to make the deal better for both of you. ## Understand what they value Remember that you can always get salary raises as you continue to work at the company, but there's only one point at which you can get a signing bonus. The easiest thing for a company to give though is stock (if the company offers stock). Companies like giving stock because it invests you in the company and aligns interests. It also shifts some of the risk from the company over to you and burns less cash. ## Be winnable This is more than just giving the company the impression that you like them (which you continually should). But more so that you must give any company you're talking to a clear path on how to win you. Don't bullshit them or play stupid games. Be clear and unequivocal with your preferences and timeline. Don't waste their time or play games for your own purposes. Even if the company isn't your dream company, you must be able to imagine at least some package they could offer you that would make you sign. If not, politely turn them down. :::tip Expert tip Get paid more. Receive salary negotiation help from [**Rora**](https://www.teamrora.com/?utm_source=techinterviewhandbook&utm_medium=referral&utm_content=website_negotiation) (risk-free) or [**Levels.fyi**](https://www.levels.fyi/services/?ref=TechInterviewHandbook&utm_source=techinterviewhandbook&utm_medium=referral&utm_content=website_negotiation) and their team of experienced recruiters. Don't leave money on the table 💰! ::: ================================================ FILE: apps/website/contents/negotiation.md ================================================ --- id: negotiation title: Negotiation description: Learn the basics of negotiation and the services you can use to significantly increase your total compensation keywords: [ FAANG, tech, jobs, negotiation, software engineer, offer, total compensation, salary, ] sidebar_label: Complete salary negotiation guide --- What you need to know about negotiation | Tech Interview Handbook ## Always negotiate If you've received an offer (or even better, offers), congratulations! You may heave a huge sigh of relief and think that the toughest parts are over. Well yes, but not entirely! For most people, the reason they're finding a new job is to increase their salary, and salary negotiation is the last stretch in achieving that goal. **Here's something that recruiters don't want you to know -** In most cases, there's room for negotiation on your offer and recruiters expect candidates to negotiate. **The initial offer that you are given is never the best package that the company can offer.** During my last job hunting experience, I received offers from numerous top tech companies like Facebook, Google, Airbnb, Lyft, Dropbox, and I have found this to be true. In most cases, you could always negotiate for more money, and some aspects of your salary is easier to negotiate than others. With multiple offers in hand, I was able to negotiate a better offer from every company. ## Negotiation services If you haven't been negotiating your past offers, or are new to the negotiation game, worry not! There are multiple negotiation services that can help you out. Typically, they'd be well-worth the cost. Had I know about negotiation services in the past, I'd have leveraged them! ### Rora How Rora works is that you will be guided by their experienced team of professionals throughout the entire salary negotiation process. It's also risk-free because you don't have to pay anything unless you have an increased offer. It's a **no-brainer decision** to get the help of Rora during the offer process - some increase is better than no increase. Don't leave money on the table! Check out [Rora](https://www.teamrora.com/?utm_source=techinterviewhandbook&utm_medium=referral&utm_content=website_negotiation). Things Rora can do for you: - Help you to negotiate increases even without competing offers - Provide tailored advice through their knowledge of compensation ranges at many companies - Provide you with customized scripts on what and how to talk to recruiters covering a range of scenarios - Mock negotiation services to help you practice - Provide you with live guidance during the recruiter call through chat - Introduce you to recruiters at other companies Book a free consultation with Rora  →

### Levels.fyi [Levels.fyi](https://www.levels.fyi/services/?ref=TechInterviewHandbook&utm_source=techinterviewhandbook&utm_medium=referral&utm_content=website_negotiation) is most famously known for being a salary database but they also offer complementary services such as salary negotiation where you will be put in-touch with experienced recruiters to help you in the process. How Levels.fyi differs from Rora is that Levels.fyi charges a flat fee whereas Rora takes a percentage of the negotiated difference. :::tip Expert tip Get paid more. Receive salary negotiation advice from [**Rora**](https://www.teamrora.com/?utm_source=techinterviewhandbook&utm_medium=referral&utm_content=website_negotiation) (risk-free) or [**Levels.fyi**](https://www.levels.fyi/services/?ref=TechInterviewHandbook&utm_source=techinterviewhandbook&utm_medium=referral&utm_content=website_negotiation) and their team of experienced recruiters. Don't leave money on the table 💰! ::: ## Negotiation courses If you are not keen on paying for negotiation services and are a fan of courses, here's something for you - the [Grokking Comp Negotiation in Tech](https://www.educative.io/courses/grokking-comp-negotiation?aff=x23W) course, a text-based course where you can get information on each aspect of negotiation. **Disclaimer: I haven't tried this course before.** ================================================ FILE: apps/website/contents/programming-languages-for-coding-interviews.md ================================================ --- id: programming-languages-for-coding-interviews title: Which programming language to use for coding interviews description: Considerations for deciding which programming language to use for coding interviews keywords: [ coding interview programming language, which programming language should i use for coding interviews, python coding interviews, java coding interviews, c# coding interviews, javascript coding interviews, ] sidebar_label: Picking a programming language --- import InDocAd from './\_components/InDocAd'; Does the programming language you use for coding interviews matter? The answer is yes. Most companies let you code in any language you want - the only exception I know being Google, where they only allow candidates to pick from Java, C++, JavaScript or Python for their algorithmic coding interviews. However, the choice you make can impact your performance much more than you'd like to believe - and this is why it is important to pick a suitable programming language early on in your coding interview preparation - and use regularly in practice. There are 3 considerations when deciding on which programming language to use: 1. Suitability for interviews 1. Your familiarity with the language 1. Exceptions ## 1. Suitability for interviews Some languages are just more suited for interviews - higher level languages like Python or Java provide standard library functions and data structures which allow you to translate solution to code more easily. From my experience as an interviewer, most candidates pick Python or Java. Other commonly seen languages include JavaScript, Ruby and C++. I would absolutely avoid lower level languages like C or Go, simply because they lack many standard library functions and data structures and some may require manual memory management. Personally, Python is my de facto choice for algorithm coding interviews because it is succinct and has a huge library of functions and data structures available. Python also uses consistent APIs that operate on different data structures, such as `len()`, `for ... in ...` and slicing notation on sequences (strings/lists/tuples). Getting the last element in a sequence is `arr[-1]` and reversing it is simply `arr[::-1]`. You can achieve a lot with minimal syntax in Python. Java is a decent choice too but having to constantly declare types in your code means extra keystrokes which results in more typing which doesn't result in any benefit (in an interview setting). This issue will be more apparent when you have to write on a whiteboard during onsite interviews. The reasons for choosing/not choosing C++ are similar to Java. Ultimately, Python, Java and C++ are decent choices of languages. - Recommended: Python, C++, Java, JavaScript - Acceptable (but prefer recommended if you are familiar): Go, Ruby, PHP, C#, Swift, Kotlin - Avoid: Haskell, Erlang, Perl, C, Matlab - You must be mad: Brainfuck, Assembly ## 2. Your familiarity with the language Most of the time, it is recommended that you use a language that you are extremely familiar with rather than picking up a new language just for using in interviews. If you are under time constraints, picking up a new language just for interviewing is hardly a good idea. Languages take time to master and if you are already spending most of your time and effort on revising/mastering algorithms, there is barely spare energy left for mastering a new language. If you are familiar with using one of the mainstream languages, there isn't a strong reason to learn a new language just for interviewing. If you have been using Java at work for a while now and do not have time to be comfortably familiar with another language, I would recommend just sticking to Java instead of picking up Python from scratch just for the sake of interviews. Doing so, you can avoid having to context switch between languages during work vs interviews. **Most of the time, the bottleneck is in the thinking and not the writing**. It takes some getting used to before one becomes fluent in a language and be able to wield it with ease. Valid reasons to learn a new language: - The interview requires usage of that language (domain-specific roles like mobile/front end/data science) - You are not in a rush to start interviewing Poor reasons to learn a new language: - The company you are interviewing with uses that language heavily and you want to impress the interviewer/show that you fit in - You want to show that you are trendy ## 3. Exceptions One exception to the convention of allowing you to "pick any programming language you want" is when you are interviewing for a domain-specific position, such as Front End/iOS/Android Engineer roles, in which you would need to be familiar with coding in JavaScript, Objective-C/Swift and Java respectively. If you need to use a data structure that the language does not support, such as a Queue or Heap in JavaScript, perhaps try asking the interviewer whether you can assume that you have a data structure that implements certain methods with specified time complexities. If the implementation of that data structure is not crucial to solving the problem, the interviewer will usually allow this. In reality, being aware of existing data structures and selecting the appropriate ones to tackle the problem at hand is more important than knowing the intricate implementation details. ================================================ FILE: apps/website/contents/resume-old.md ================================================ --- id: resume-overview title: Resume overview sidebar_label: Overview --- Resume screening is the first stage in the interview process. It doesn't matter how strong you are in CS, algorithms or LeetCode, if you submit a poorly-written resume that doesn't pass the resume screening stage, your hopes are dashed. Hence it is important to nail this stage. The following content is by Christina Ng and rephrased for the purpose of this handbook. You can follow her on [Medium](https://medium.com/@christinang89) or [Quora](https://www.quora.com/profile/Christina-Ng). ## How your resume is screened While many engineers can be rather qualified for the role they are applying for, they miss out on getting a shot at the interview as they might never get past resume screening. The main issue was that they do not understand how recruiters worked. Before writing your resume, it is important to understand the recruiting structure and how recruiting is done. ## The skill set checklist Before opening up a position/starting the search for candidates, I usually consult very closely with the team manager/decision maker to find out the specific skill sets that are relevant for the position. These skill sets are typically grouped into "Must have", "Good to have", and "Special bonus". - "Must have" — Typically, most of the must-haves include a degree (or not) in a relevant technical field, some years (or not) of experience in a particular programming language or technology - "Good to have" — Includes experience/familiarity with secondary languages/technologies which may not be directly relevant to what the candidate would be working on, but could be required due to some interfacing with other components of the project. It could also include softer skills such as being a good team player, clear communication, etc - "Special bonus" — Recognized skill sets/experiences which are difficult to come by. Probably not a requirement, but would definitely be useful for the position Now that I am armed with this list, the search for candidates begin. Typically, I do not seek that "one perfect candidate". What I seek for is the "best fit candidate". The search is essentially a numbers game. I know that for a specific job posting, there would perhaps be X applicants. At each stage of the interview process, some percentage of the candidates will be eliminated, leaving only a final Y% of the initial pool to choose from. Since Y tends to be a rather small number, recruiters will try to maximize X. ## The 10 seconds glance When I am looking at your resume, I am doing a keyword match against the skill set checklist. If I see a good amount of the right keywords in your resume, it is a pass. If I need to spend more than 10 seconds trying to figure out what you are writing about, it is a fail. If I see an excessive amount of keywords (much looking like spam), it signals a red flag and goes into the "maybe". Depending on whether I think I have enough candidates for the day, you could eventually go into the pass or fail stack. There are lots of articles writing about how recruiters only spend an average of about 10 seconds to screen each resume. The news is, this is true because resume screening is such a menial, robotic and repetitive task. In fact, many applicant tracking systems (ATS) now are so advanced that they can parse your resume automatically, search for specific keywords in your resume, and score your resume based on the weights pre-assigned to each keyword. Finding a job is a two-way fit — the company wants someone with the relevant skills required, but it is also important for the applicant to fit in the company culture, and be able to gain something out of their stint. Hence, honesty is the single most important criteria in a resume. There is a delicate balance between finding the right job vs. finding a job. Getting rejected does not always mean you are not good enough. Sometimes, it just means you are not a right fit for what the company is looking for. When hiring fresh grads, I know that many of them will not have as much experience as someone who has years of industry experience. Hence, I would look out more for soft skills, such as attention to detail, initiative, passion, ability to get things done, etc. Note: this applies only if you have met the minimum threshold of proficiency/competency in the skill set checklist. ================================================ FILE: apps/website/contents/resume.md ================================================ --- id: resume title: Practical guide to writing FAANG-ready software engineer resumes description: How to write a top-tier, ATS-friendly resume good enough to pass resume screenings by Google, Amazon, Facebook and Microsoft keywords: [ software engineer resume, FAANG software engineer resume, software engineer resume template, software engineer resume examples, software engineer resume sample, software engineer resume best practices, how to write software engineer resume, ] sidebar_label: Writing your software engineer resume --- import InDocAd from './\_components/InDocAd'; Not sure why you're still not getting shortlisted at some or all of the top tech companies? Your software engineer resume could be the issue. Having read tons of software engineering resumes as a FAANG interviewer, even some of the most qualified candidates I know fail to get shortlisted due to bad resumes. The mistake most people make is to immediately assume that they weren't qualified enough - but that could be far from the truth. Thankfully, there are specific steps and requirements you can fulfill to write a good software engineer resume. From your resume structure, content, to free tools you can use to test your resume, I have collated a very concise summary of the best practices to prepare your resume for a FAANG software engineering job application: 1. Set up an ATS-friendly resume template 1. Fill up your template with well-framed content in a meaningful order 1. Optimize your resume with prioritization and keywords 1. Test out resume using free tools ## How to set up an ATS-friendly software engineer resume Something most candidates may not realize is that most top tech companies are using some form of Applicant Tracking Systems (ATS) to parse and screen thousands of resumes even before they reach human eyes. In many companies, the ATS may even use certain rules to reject candidates automatically. While different companies could be using different types of ATS, it is possible to ensure that your software engineer resume is read favorably by most ATS. This section ensures your resume is at least perfectly readable by the ATS, while the next few sections improve your chances of passing ATS screenings. :::tip Expert tip [FAANG Tech Leads](https://www.faangtechleads.com?utm_source=techinterviewhandbook&utm_medium=referral&utm_content=ats_template&aff=1e80c401fe7e2) is currently offering resume templates and examples at **70% off**. Their templates: - Are created by ex-FAANG hiring managers based on top resumes received from hundreds of candidate applications - Guarantee readability by FAANG ATS - Cater to various experience levels They also offer resume examples/references from candidates who have received multiple offers from FAANG companies - which are helpful in helping you craft content that meets the same bar. [Check it out](https://www.faangtechleads.com?utm_source=techinterviewhandbook&utm_medium=referral&utm_content=ats_template&aff=1e80c401fe7e2)! ::: ### Only use Microsoft Word or Google Docs to create and edit your resume **Do's** - Submit your resume as a PDF file to preserve formatting, but always create it from Microsoft Word or Google Docs. It is important to ensure that the text in your resume is easily highlightable, which is a precondition for easy parsing. - ATS tools are always trying to improve their readability of standard resume formats - hence the more commonplace your resume format is, the better. - To maximize space on your resume, rather than using header or footers, reduce the margins of the page - narrow margins are 0.5 on each side. **Don'ts** - Do not use Photoshop, other graphic design tools or online resume builders to build your resume - Do not use the header or footer sections in a Word/Google Docs file - reduce margins instead and just write the information in the body. ### Only use standard fonts of readable sizes New fonts may convert letters into special characters which are not readable by the ATS. Fonts you should use - **Arial, Calibri, Garamond**. Ensure your font size remains readable for humans later on in the hiring process - use a minimum size of **10 pt** for readability. ### Add sections with standard headings and ordering ATS readers need to identify and parse standard types of information from your resume. Using standard header titles and ordering can help them do that better. This is the order which has worked well for me and recommended by recruiters: | Section | Heading Name | | --- | --- | | Professional summary | (Use resume headline as section title, for e.g. "Senior Software Engineer at Google with over 5 years of experience leading teams") | | Contact information | "Contact Information" | | Skills - programming languages, frameworks, etc. | "Skills" | | Experience | "Work Experience" | | Education (Note: if you are still in school or have less than 3 years of experience, you may put Education first) | "Education" | | Projects | "Projects" | | Other optional sections - e.g. Certifications, Awards, etc | "Awards and Accolades" / "Certifications" / "Awards, Accolades and Certifications" | :::caution Never add symbols to your headers to avoid ATS readability issues. ::: ## How to write good Software Engineer resume content As software engineering is inherently different from other careers in terms of its required skills and experiences, the content expectations for a software engineer resume is also unique. Each of the following paragraphs will cover the content usually expected for software engineers within each resume section: ### How to write a professional summary for a software engineer A good professional summary can be a game changer. Not only does it summarize your entire professional experience in a manner that individual sections cannot, it can also leave a pleasant impression on the hiring manager. From my personal experience as a software engineering interviewer, I highly recommend professional summaries, as interviewers generally may not have the time to read into the detail - hence summaries which directly address why a candidate is a good fit for the job greatly improves their chances of capturing attention. Here are my top tips for writing a great software engineering resume summary. #### Before you start: List down your best selling points From your entire professional experience, list down the most important points that fulfill the job descriptions that you are applying for. This can include job experiences or skills. #### Summarize the selling points into your resume summary Summarizing the selling points as much as possible, frame them into a short summary of less than 50 words: Ensure you do these: - ✅ Answer why you are a good fit for the job - ✅ Use an active voice - ✅ Use action words - ✅ Start with the noun describing your job role e.g. "Software Engineer", "Front End Engineer" #### Write a headline for your resume summary Instead of writing "Professional Summary" as the title of the section, further concise your experience into a headline with fewer than 10 words. Treat it like a slightly more elaborate version of your LinkedIn profile headline. Some examples: ##### Software Engineer (Full Stack) Software Engineer with X years of full stack web development experience specializing in Ruby on Rails and PostgreSQL. Domain expert in e-commerce and payments field as a result of working at multiple e-commerce companies. ##### Senior Front End Engineer Front End Engineer with X years of experience and strong fundamentals in Front End technologies. Likes building scalable web infrastructure and making websites fast. Passionate about programming languages, compilers, and developer tooling. ##### Software Engineering Lead Software Engineer with X years of experience in back end, scaling complex distributed systems, and various cloud platforms. Led over 5 engineering teams with an average size of 6 members across two companies and mentored over 20 junior members. ##### Senior at University X Senior Year student at University X with a focus on Artificial Intelligence and Machine Learning (ML). Interned at X companies and worked on full stack development and ML engineering roles. :::info Read more about how to make your Professional Summary stand out on [FAANG Tech Leads' Resume Handbook](https://www.faangtechleads.com/resume/professional-summary). ::: ### How to write contact information for a Software Engineer #### Must-haves - Name (Should be included at the very top of the resume) - Personal phone number - Never include your work phone number here - Location - City, State, Zip - Just enough for recruiters to determine if you are a local or international candidate - Email address - Never include your work email here - I recommend Gmail if you are using other email services - LinkedIn profile #### Good-to-haves - GitHub profile URL - Personal website URL - Stack Overflow profile URL - Medium profile URL - Competitive coding profile - CodeChef - HackerRank If a divider is required between information, use "|" or tabs Where relevant, indicate achievements in coding platforms, for example, max ratings, ranking, number of stars, badges. :::info Read more about getting your contact information section right with [FAANG Tech Leads' Resume Handbook](https://www.faangtechleads.com/resume/contact-information). ::: ### How to write skills for a Software Engineer Include programming languages and tech stacks: Structure in the following manner: > [Skill summary] : [List skills separated by "|"] - Programming languages - If impressive, include your familiarity by the number of lines you have written, for example "Over 10,000 lines" - Frameworks - Databases :::info Read more about listing your skills accurately right with [FAANG Tech Leads' Resume Handbook](https://www.faangtechleads.com/resume/skills). ::: ### How to write work experience for a Software Engineer List your work experience in a familiar format and reverse chronological order. Every job listed should have: The company, location, title, duration worked following this structure > [Company or Organization], [Location] | [Job Title] | [Start and end dates formatted as MM/YYYY] Example > Facebook, Singapore | Front End Engineering Lead | 08/2018 - Present List of top accomplishments, including: - Scope of job and skills required - Accomplishments listed following this structure - > [Accomplishment summary] : [Action] that resulted in [quantifiable outcome] :::info Read more about presenting your conveying job experience well on [FAANG Tech Leads' Resume Handbook](https://www.faangtechleads.com/resume/work-experience). ::: ### How to write education for a Software Engineer Most software engineering jobs will require at least an undergraduate degree. However, unless you are a recent graduate or do not have much work experience, it should not be prioritized above your work experience. Use the following format, eliminating information where it is not relevant: > [Degree Name], [Year of Graduation - write expected graduation date if not graduated]
[University Name], [Location]
GPA: X.XX / 4.0 (List GPA if more than 3.50/4.00, or more than 4.3 under a 5-point system)
List key achievements, including leadership positions, skills, societies, projects, awards, etc. Example: > BSc in Computing, Computer Science, Graduation Year 2015
National University of Singapore, Singapore
GPA: 3.82 / 4.00 (Magna cum laude)
Dean's List, Valedictorian
President of hacker society :::info Read more about writing your education history on [FAANG Tech Leads' Resume Handbook](https://www.faangtechleads.com/resume/education). ::: ### How to write projects for a Software Engineer Include at least 2 projects you have contributed to, outlining your key contributions. Always try to link your project name to GitHub or somewhere the hiring manager can view your project. > [facebook/docusaurus](https://github.com/facebook/docusaurus)
Maintainer and lead engineer for Docusaurus v2, a static site generator which powers the documentation of many of Meta's Open Source Projects - React Native, Jest, Relay, Reason, etc. Used by 7.6k > projects on GitHub. ### How to write awards, accolades and certifications for a Software Engineer Only include achievements related to the job application and try to quantify your achievements. A good format to use would be > [Year] [Quantification] [Competition] Example > 2016 | Best All-Round Product out of 50 teams | Facebook Hackathon :::info Read more about presenting your projects effectively on [FAANG Tech Leads' Resume Handbook](https://www.faangtechleads.com/resume/projects). ::: ## Optimize your resume with keywords must-haves to optimize your content: ### Less is more **Do's** - Highlighting a few of your best achievements is better than including many "average" achievements in your resume - Use only 1 page for your resume **Don'ts** - Do not list all your achievements just to showcase a greater quantity without filtering ### Keyword optimization Imagine you are a hiring manager or recruiter screening a resume while juggling many other tasks in your job - you simply won't have much time on each resume! When a hiring manager looks at a resume, they are in fact quickly scanning for keywords of skills or experiences that they value, before paying any additional attention to your resume. Recruiters and ATS do that as well, but based on the job description that the hiring manager helped to write. That is why optimizing your resume based on job descriptions is very important. :::info Some ATS will determine the strength of your skills based on the frequency of a keyword in your resume, and others assign an estimated amount of experience for a skill based on its placement in your resume. For instance, if your previous job experience was 3 years long and you mentioned handling Search engine marketing (SEM), the ATS will assume 5 years of SEM experience. ::: #### Include keywords from job descriptions into your resume You should always analyze the job description for must-have and good-to-have skills or experiences and ensure the keywords are added to your resume. Include them under the "Skills" section and pepper the same keywords into the "Work Experience" and "Education" sections. Be sure to closely imitate the language within the job description. Remember to include the full version of common abbreviations as well. E.g. Amazon Web Services instead of AWS, Google Cloud Platform instead of GCP. However, do not do keyword stuffing for the sake of it - always remember that the resume will be read by a recruiter or hiring manager eventually. #### Optimize keyword frequency and placement Analyze the job description and determine how important each skill and experience is, then optimize the frequency of the keyword according to its importance. :::tip Expert tip While optimizing for every application is ideal, you can generalize your resume to a type of position. 1. Collate 3 to 5 job descriptions for that position 1. Copy and paste them into a `.txt` file and upload it into a free "word and phrase" frequency tool like [Online-Utility.org's Text Analyzer](https://www.online-utility.org/text/analyzer.jsp) to identify regularly used keywords 1. Incorporate skills and experiences that you have into the resume ::: ## Tools to review your resume I recommend using these tools to optimize your resume: ### 1. Resume review If you are willing to spend some money we recommend [FAANG Tech Leads' Resume Review service](https://www.faangtechleads.com?utm_source=techinterviewhandbook&utm_medium=referral&utm_content=ats_template&aff=1e80c401fe7e2) where your resume will be reviewed by ex-FAANG hiring managers and engineers, not random writers who don't understand technology. ### 2. Test readability with industry-standard ATS - Test the readability and formatting of your resume using industry-standard ATS like [Resume Worded](https://resumeworded.com/resume-scanner) or free tools like [AI Resume Judge](https://ayehigh.com/resume-judge). Most big companies use such resume scanners. - Tailor your resume according to the job requirement. You can use tools like [Targeted Resume](https://resumeworded.com/targeted-resume) or [Resume Shortlister](https://ayehigh.com/resume-shortlister) to check how good your resume is for the job you are applying for. It gives you good improvement tips and a list of keywords that you can add to your resume for better chances in ATS ranking. ### 3. The plain text file test Simply copy the content from your resume and paste it into a plain text document! Make edits if: - There are points missing from your original resume - Characters are displaying incorrectly in plain text - Sections are disorganized ## Crafting the perfect cover letter Your cover letter serves as a handshake, an introduction to the professional persona encapsulated in your resume. It's an avenue to express your genuine interest in a position or a particular company, portraying the value you can add to the organization. Unlike the formal tone of a resume, a cover letter allows for a unique, creative expression of your personal brand, ensuring it **complements rather than replicates** your resume. **Tailoring is key in crafting a compelling cover letter. **It is about aligning your skills and aspirations with the role at hand, going beyond mere name switches. Hence, delve into the company's ethos, the industry, and the specific role, letting your cover letter reflect a clear understanding and a deliberate choice. You need to show that you have done your research and you understand the company mission and how you will contribute towards that goal. :::tip Expert tip The cover letter should **highlight the resume, rather than duplicate the content** (which is what is seen too often). In some cases, the cover letter will be the first document, and sometimes, the only document an employer or recruiter sees, and as such, should make a stellar first impression. ::: Here's a structure to transform your cover letter into a compelling narrative: - Capture Attention: In your opening paragraph, succinctly present the primary reasons you are an ideal candidate for the job. - Express Your Value: Highlight **what you bring to the table**, how you can contribute to the company's goals. - Narrate Succinctly: People resonate with stories. Share a **brief, relevant narrative** that leaves the reader intrigued. Similar to your resume, you should very rarely go beyond the one page limit. ### Common pitfalls to avoid on your cover letter - The Generic Trap: **Tailor your cover letter** to the job and company. Avoid a one-size-fits-all approach. - Repetition: Your cover letter should **accentuate your resume, not echo it.** - Over-verbosity: Keep it crisp, to the point, and **under a page.** - Sloppiness: Errors in spelling or grammar reflect poorly on your attention to detail. Proofread meticulously. ### Practical tips - Align your qualifications with the employer's needs. - Keep it engaging. Avoid cliches and standard phrases. Your first paragraph should capture the attention of the employer. - Ensure your cover letter is free from errors. Enlist a friend to review it or put it aside and review with fresh eyes later. ### Cover letter example and evaluation Example of an ML Engineer Cover Letter: 1. _Paragraph 1: The Hook and personal touch_

> Growing up in Argentina, questions about economics are part of everyday life long before you become an Economics student. While many developing countries suffer the consequences of natural disasters or geopolitical conflicts, most - generations of Argentines have spent their entire lives avoiding the consequences of the crisis caused by macroeconomic imbalances in our country. Possibly due to this history, it is practically impossible to spend a day of your life without listening to a friend or family member make predictions about what the exchange rate between the peso and the dollar should be, or their opinion about what should be done by the Central Bank to lower inflation.

2. _Paragraph 2: Motivation, background and growth story_

> Curiosity to find an answer to these daily questions was what motivated me to start my Degree in Economics at the University of Buenos Aires. I did my entire university career while working at the [BANK], experience that was exhausting and challenging in similar proportions. During my eight years working in a financial institution, I have seen first-hand how new technologies and Big Data tools have been transforming the way in which corporate decisions are made. That aroused my curiosity in the different Machine Learning techniques and for that reason I moved to Madrid to perform my Master in Big Data. After that, I was approached by a recruiter that gave me the opportunity to unleash my skills in the gaming industry in London. 3. _Paragraph 3: Showcase achievements, impact and stakeholder management_

> [GAMING COMPANY] gave me an incredible opportunity. For the first time in my career, I was able to connect my childhood memories as a gamer with my professional skills. The capable leadership at [GAMING COMPANY] quickly identified my project management and analytical skills and they gave me huge responsibilities. I worked closely with the Chief Strategy Officer and the Head of External Developer Relations to identify potential publishing and M&A opportunities. During my watch we closed two strategic deals that are now contributing with more than 10% of the portfolio revenue. After that incredible experience, I was invited to join a start-smaller SaaS mobile data company called [SAAS COMPANY]. It was a hard decision but the challenge of joining a start-up and helping they grow and expand globally was an opportunity that I could not decline. 4. _Paragraph 4: Motivation to join the company aligned with personal values_

> After [SAAS COMPANY] I had the opportunity to apply my skills in the Fintech industry. Coming from Argentina, where the population suffer the consequences of the absence of good credit, I was extremely excited about [BNLP FINTECH]’s mission of democratizing free-credit in the UK and the U.S. ## Final tips ### Do not take job application forms lightly If the company you are applying for requires you to fill in the "Work Experience" and "Education" sections into their own form, do not take it lightly! Most of the time, these are internal HR applications which help parse job applications and filter out candidates from the information provided. In fact, it is possible that your resume is never seen by the recruiter or hiring manager - only the information that you fill up in their forms! ### Do not apply to many jobs at the same company The ATS also allows recruiters to see all the roles you have applied to at their company. Try not to apply to too many jobs as a recruiter wouldn't be able to tell if you're actually interested in or if you're self-aware about your abilities. E.g. applying for a Software Engineer and a Data Scientist role at the same company is not a good idea. --- And that is it from me in terms of resume preparation - hope this helps! If you have any other tips you would like to share with others on Tech Interview Handbook, do reach out to me at contact@techinterviewhandbook.org or create a new [GitHub discussion item](https://github.com/yangshun/tech-interview-handbook/discussions).
Summary of the 4 steps to create a great software engineering resume, in checklist format
Summary checklist of the four key steps to create a great software engineering resume
================================================ FILE: apps/website/contents/self-introduction.md ================================================ --- id: self-introduction title: 'Software Engineer interviews: Crafting the perfect self introduction' description: How to answer "Tell me about yourself" for Software Engineer interviews keywords: [ tell me about yourself software engineer, software engineer self introduction, software engineer self introduction sample, tell me about yourself software engineer example, self introduction software engineer sample, ] sidebar_label: Preparing a self introduction --- import InDocAd from './\_components/InDocAd'; _The following page is a collaboration with [Austen McDonald](https://www.linkedin.com/in/austenmc/), former Senior Engineering Manager and Hiring Committee Chair at Meta, and author of [Mastering Behavioral Interviews](http://thebehavioral.tech/)._ "Tell me about yourself" or "give me a quick introduction of your profile" is almost always the first question encountered in your software engineer interviews. This guide teaches you how to maximize this chance to impress the interviewer by crafting the perfect self introduction. Interviewers want to work with candidates they like. Leave a good/deep impression and it will increase your chances of success. Most of us are not strangers to self introductions as we meet new people now and then and have to introduce ourselves every once in a while. However, self introductions in interviews are slightly different from real life - you need to tweak it to your advantage - tailor the self introduction to the role and company you are applying for! Your self introduction evolves as you grow and are at a different stage of your career. When answering "tell me about yourself", you can rephrase the question into: > "Tell me about your journey into tech. How did you get interested in coding, and why was web development (or replace with other job-specific skills) a good fit for you? How is that applicable to our role or company goals?" It is probably not a good idea to spend valuable time talking about things which aren't relevant to the job! ## Make an elevator pitch An "elevator pitch" originates from a journalist trying to pitch an idea to an editor. The only time to catch the editor was in the elevator and she had only around 30 seconds to do so. The key elements of elevator pitches include: - **Short** - You have limited time! - **Direct** - As you only have limited time, you should get to the point - **Attention-grabbing** - Present your most attractive ideas Whether you're at a job fair with hundreds of other candidates and you have limited time or you are simply explaining who you are to a potential connection or client, it is important to be able to clearly and accurately describe your knowledge and skills quickly and succinctly. Your self introduction is an elevator pitch for yourself! Here are some tips to develop a good elevator pitch for your software engineer self introduction: ### 1. Start with basic background information Include who you are, who you work for (or school and major), and what you do. - **Internships** - You should mention the following: name, school and major, focus areas, past internships and/or noteworthy projects - **Full-time** - You should mention the following: name, past companies, noteworthy projects (best if it's a public consumer product that they would have heard of) Does this look familiar? It should be, because it is similar to your resume! Your resume is a condensed version of your knowledge and experiences and your self introduction is essentially a condensed version of your resume. As you grow older, professional experience becomes more important and school background becomes less important. Hence your self introduction changes as you become more senior. ### 2. KISS (Keep It Simple and Sweet) Tell them some highlights from your favorite/most impressive projects and including some numbers if they're impressive or challenges that you've overcome. Do not delve into the depths of how you reverse engineered a game and decrypted a packet to predict when to use your DKP on a drop. Tell them the executive summary: "I reverse engineered X game by decrypting Y packet to predict Z." If this catches their interest, they might ask further questions on their own. Avoid a history lesson. "I started coding when I was 13 years old, went to college at State U, then worked as an intern for BigCo, then out of college I got a front-end job at SmallCo, then moved to backend at Acme, ..." is not adding value to the listener. In the discussions of your past, include roles that were meaningful and have some takeaway. For example, instead of the history lesson, try "I’ve had roles across large and small companies as well as worked across the stack." ### 3. Why do they want you?​ Tell the interviewer why you would make a good hire. Is your experience relevant to the company? Have you used a similar tech stack as the company or built relevant products? What unique talent(s) do you have that may give them confidence about your ability to contribute to the company? ### 4. Practice!​ Lastly, you must practice your pitch! Having a great, succinct summary of your skills only helps if you can actually deliver it rapidly! You should practice keeping a quick but easy-to-follow pace that won't overwhelm them but won't bore them. It's a precarious balance, but can be ironed out with practice. After coming up with your self introduction, keep it somewhere where you can refer/tweak in future. Memorize them and in future you can just use it when you need to but don't sound like you're recalling it from your memory when you're actually saying it out. Sound natural! Having an elevator pitch on hand is a great way to create a network and chance upon new job opportunities. There will often be times when you can't prepare for an interview or meeting and it is incredibly handy to have a practiced pitch. ## Good examples of software engineer self introductions ### Example 1: Front End Engineer at Meta #### Self introduction > "Hi I'm XXX and I graduated from National University of Singapore in 2015 with a degree in Computer Science. My interests are in Front End Engineering and I love to create beautiful and performant products with delightful user experiences. > > Back in school, I designed and built a web application, NUSMods which solves a huge problem of class and timetable planning every semester. It receives over a million pageviews a month and is used by over 40,000 NUS students and even some professors. It is built using a modern web technology stack - React, Redux, Jest, Babel, Flow, webpack and is mobile-responsive." > > I'm interested in the Front End Engineer role at Meta because I have been using Meta Open Source Front End technologies for a while now and am inspired by Meta's mission and Open Source culture. #### Breakdown > "I love to create beautiful and performant products with delightful user experiences." Qualities that a Front End engineer should possess. > "It receives over a million pageviews a month and is used by over 40,000 NUS undergraduates and even some professors." Mention something about the project which stands out. > "It is built using a modern web technology stack - React, Redux, Jest, Babel, Flow, webpack and is mobile-responsive." Meta tech stack! Also hints that you keep yourself updated with modern web technologies. ### Example 2: Front End Engineer at Lyft #### Self introduction > "Hi I'm XXX and I graduated from National University of Singapore in 2015 with a degree in Computer Science. My interests are in Front End Engineering and I love to create beautiful performant products with delightful user experiences. > > I previously worked at Grab where I led the Grab for Work project. Grab for Work was a service for companies to make corporate transportation expenses convenient. Companies can create employee groups, set ride policies and share corporate payment methods with their employees. I built the project with another engineer over the period of 3 months on a React/Redux and Golang stack." > > I'm interested in the Front End Engineer role at Lyft because I like working in this ridesharing space and creating products to improve the lives of users. #### Breakdown > "I love to create beautiful and performant products with delightful user experiences." Same as above, qualities that a Front End engineer should possess. > "I previously worked at Grab where I led the Grab for Work project." Lyft was Grab's sister company! In fact they even had a partnership in the past. Most Lyft engineers would have heard of Grab before and mentioning this catches their attention. > "I built the project with another engineer over the period of 3 months on a React/Redux and Golang stack." Acknowledge that you work with others. Building a non-trivial system with just 2 people in 3 months is quite good for a non-trivial system. Lyft also uses Golang for their high performance systems. ================================================ FILE: apps/website/contents/software-engineering-interview-guide.md ================================================ --- id: software-engineering-interview-guide title: 'Software Engineer interviews: Everything you need to prepare' description: What to expect, how to prepare and how to excel in Software Engineering interviews keywords: [ software engineer interview preparation, technical interview preparation, how to prepare for your software engineer interview, software developer interview, coding interview preparation, best leetcode questions, coding interview questions, software engineering interview questions, ] sidebar_label: 'SWE interviews: What are they and how to prepare' --- import InDocAd from './\_components/InDocAd'; Nobody has time to grind hundreds of LeetCode questions, and the good news is that you don't need to do that many to actually get the job at FAANG! I was frustrated at my job at Grab, a ridesharing company in South-east Asia and wanted to break into FAANG but I wasn't sure how to. After a few months of research, studying and practicing, I interviewed at 11 companies and managed to get 9 offers from top tech companies in the Bay Area - Facebook, Google, Airbnb, Palantir, Dropbox, Lyft, and some startups. It was a tedious process which I don't ever want to go through again. **I went through that process but with this guide, you don't have to.** This guide will provide a **quick overview of the top tips on how to prepare for a software engineer interview** - both technical and non-technical interview rounds. Where relevant, you can delve into greater detail by accessing links in this overview article, or through the website's left sidebar. How to prepare for your software engineering interview: 1. Maximize your chances of being shortlisted 1. Find out the interview format 1. Pick a programming language 1. Sharpen your Computer Science fundamentals for interviews 1. Practice for the coding interview 1. Prepare for the system design interview (for mid/senior levels) 1. Prepare for the behavioral interview 1. Negotiating the offer package ## Maximize your chances of being shortlisted Do you still have trouble getting shortlisted at some or all of the top tech companies? Your resume could be the issue. Your resume is the single most important entry point to getting shortlisted in major tech companies like FAANG / MANGA. After getting shortlisted, your past achievements become markedly less important as compared to your coding interview skills - which as we know, can be methodically learnt. Being able to frame your past achievements well enough to get through the screening stage is hence very important. Unfortunately, even the most qualified candidates I know personally don't know how to write a good resume and fail to get shortlisted. The truth is that when many of us don't get shortlisted at top tech companies like FAANG / MANGA, we tend to think that we were under-qualified - but in most cases, it's probably just the lack of good framing. If you want to learn how to write a good software engineer resume, I've written a [step-by-step guide here on software engineering resume preparation](./resume.md) for companies like Google, Facebook, Amazon, Netflix, Apple, with examples for your reference as well. ## Find out the interview format You may encounter various interview formats in your software engineer interviews (from early to late stage): ### 1. Quiz Frequency: Occasional Quizzes are meant to be a first-pass filter as a quick and dirty way of weeding out extremely weak (or even non-technical) candidates. They are structured questions and have clear-cut answers which makes them possible to be administered by recruiters/non-technical folks or automated graders. They are typically done early in the process. Examples: - What is 4 & 5 (in binary)? Answer: 4 - What is the time complexity of bubble sort? Answer: O(n2) ### 2. Online coding assessment Frequency: Occasional Like quizzes, online coding assessments are usually given early in the process. An algorithm problem is given with well-formed input and output and candidates are expected to write code in an online coding interface to solve the problem. [HackerRank](https://www.hackerrank.com) is a very common platform for conducting online coding assessments. LeetCode would be a good way to practice for the problem solving aspects of online coding assessments. However, in HackerRank you are typically expected to write code to read from stdin and also print to stdout, which can trip candidates up if they aren't familiar with the APIs. ### 3. Take home assignment Frequency: Rare There have been numerous debates on whether asking algorithm questions are a good way of assessing individual abilities as they aren't exactly the most relevant skills needed on a day-to-day basis at a job. Take home assignment is a format designed to address the shortcomings of the algorithm interview by getting candidates to work on larger projects which allow them to demonstrate software design skills. However, this interview format takes up more time from both the candidates and the company and hence it is not as commonly seen in large companies where they have a high volume of candidates. This format is more common among startups and small companies. Examples - Build a flights listing app - Build a kanban app - Build a snake game ### 4. Phone screen interviews Frequency: Common Phone interviews are the most common format and every candidate will face this at least once while interviewing. You will be asked to speak with an interviewer either over a phone call or VoIP (BlueJeans/Skype/Google Hangout). A question will be given to you and you will work on that question using an online collaborative editor (CoderPad/CodePen/Google Docs). You are usually not allowed to execute the code even if the editor supports execution. So don't rely on that for verifying the correctness of your solution. Formats would differ slightly depending on the roles you are applying to. Many companies like to use [CoderPad](https://coderpad.io) for collaborative code editing. CoderPad supports running of the program, so it is possible that you will be asked to fix your code such that it can be run. For front end interviews, many companies like to use [CodePen](https://codepen.io), and it will be worth your time to familiarize yourself with the user interfaces of such web-based coding environments. Check out [coding interview best practices](./coding-interview-cheatsheet.md) as well for do's and don'ts before your phone screen interviews. ### 5. Onsite Frequency: Almost always If you have made it to this stage, congratulations! This is usually the final stage before an offer decision. Candidates who made it to the onsite stage will be required to have an in-person interview at the office. If you are an overseas candidate, companies might even fly you in and pay for your accommodations! The onsite stage usually consists of multiple rounds (coding, system design, behavioral) and is expected to last for a few hours. Since you are onsite, it is possible that you will be asked to do a whiteboard exercise with an interviewer, usually either solving an algorithm question or a system design question. It is also possible that you have to bring your own laptop and work on a project/solve a coding problem on the spot. For onsite interviews at smaller (non-public) companies, most will allow (and prefer) that you use your own laptop. Hence it is important that you prepare your development environment in advance. If the company provides lunch, you might also have a lunch session with an employee where you can find out more about the company culture. ## Pick a programming language With your resume done, the next step of your software engineering interview journey is a simple one and won't take long - decide on a programming language. Unless you're interviewing for a specialist position like mobile or front end where there are domain-specific languages, you should be free to use any language you want for the algorithmic coding interviews. Most of the time, you'd already have one in mind - pick the one you use the most and you're the most comfortable with. The most common programming languages used for coding interviews are Python, Java, C++, and JavaScript. I wouldn't recommend learning an entirely new language just for coding interviews as it takes a while (few weeks at least on average) to become proficient enough in a language to wield it comfortably in an interview setting, which is already stressful enough on its own. My personal programming language of choice is Python because of how terse it is and the functions/data structures the standard library provides. Read more on programming languages for coding interviews: [Picking a programming language](./programming-languages-for-coding-interviews.md) ## Study and practice for coding interviews The next and most important step is to practice solving algorithm questions in your chosen programming language. While Cracking the Coding Interview is a great resource, I prefer learning by actually solving problems. There are many platforms that can be used for this - such as LeetCode, HackerRank and CodeForces. From my personal experience, LeetCode questions are most suitable for interview preparation whereas HackerRank and CodeForces are more for competitive programming. However, LeetCode has thousands of questions and it can be daunting to know where to begin, or how to structure your practice. I have provided recommended preparation plans and also structured resources here: ### Coding interview study plan The recommended time period to set aside for coding interview preparation is 3 months (11 hours a week i.e. 2-3 hours a day) for a more holistic preparation. I shared my [3 month study plan here](./coding-interview-study-plan.md), which provides a list of coding interview topics with resources and practice questions that you should work through in order of priority every week. I will also be adding content on recommended 1 month and 1 week study plans soon. If you have less than 3 months to prepare, you can generate your own study plans using the [Grind 75 tool](https://www.techinterviewhandbook.org/grind75/) (built by me) which generates recommended study plans for coding interviews based on the time you have left. The algorithm behind it includes a ranking of questions by priority and also a balance between breadth and depth of topics covered. ### Resources to use in your practice In the market, there are plenty of resources vying for your attention, plenty of them just vying for your money but not providing any value. If I had to prioritize - these are the top coding interview preparation resources I would use in tandem: 1. [Grokking the Coding Interview: Patterns for Coding Questions](https://www.designgurus.io/course/grokking-the-coding-interview?aff=kJSIoU) 1. [AlgoMonster](https://shareasale.com/r.cfm?b=1873647&u=3114753&m=114505&urllink=&afftrack=) 1. My (free) coding interview best practices guide 1. My (free) coding interview techniques guide 1. My (free) algorithms study guide #### [AlgoMonster](https://shareasale.com/r.cfm?b=1873647&u=3114753&m=114505&urllink=&afftrack=) Apart from helping you master important coding interview data structures and algorithm questions through practice and easy to understand guides, AlgoMonster has the added perk of synthesizing [common interview question patterns](https://algo.monster/problems/stats) that you could apply to solve any other questions you have never encountered before. Made by Google engineers, this is definitely a quality platform to use as compared to the unstructured nature of LeetCode grinding. Data structures and algorithms questions are covered in all the common languages - Python, Java, C#, JavaScript, C++, Golang, and more. [**Join today for a 70% discount →**](https://shareasale.com/r.cfm?b=1873647&u=3114753&m=114505&urllink=&afftrack=) #### [Grokking the Coding Interview: Patterns for Coding Questions](https://www.designgurus.io/course/grokking-the-coding-interview?aff=kJSIoU) This course by Design Gurus expands upon the questions on the recommended practice questions but approaches the practicing from a questions pattern perspective, which is an approach I also agree with for learning and have personally used to get better at coding interviews. The course allows you to practice selected questions in Java, Python, C++, JavaScript and also provides sample solutions in those languages along with step-by-step visualizations. **Learn and understand patterns, not memorize answers!** [**Get lifetime access today →**](https://www.designgurus.io/course/grokking-the-coding-interview?aff=kJSIoU) #### My (free) coding interview best practices guide If you have read the [coding interview evaluation rubric](./coding-interview-rubrics.md) used at top tech companies, you may be overwhelmed by the number of items evaluated and how to demonstrate hire behaviors consistently. This [coding interview best practices guide](./coding-interview-cheatsheet.md) synthesizes actionable recommendations of what to do before, during and after your coding interviews to demonstrate hire signals. I recommend to internalize and use the guide as an accompaniment while you practice coding interview questions - to ensure that you cultivate good habits and muscle memory with regards to interviews right from the beginning. #### My (free) coding interview techniques guide Is there a structured method to increase your chances of finding a good solution to the coding interview question? How about optimizing your approach's time and space complexity? My coding interview techniques guide teaches you a few techniques for handling questions that you have never encountered before - such as problem visualizing, solving by hand, breaking the problem into subproblems, etc. #### My (free) algorithms study cheatsheets I'm not sure if these would qualify as an in-depth guide - they are more like 1-page "study cheatsheets" of the **best resources to study, best LeetCode questions to practice and the things to remember**. However, they ensure you cover all the most important grounds, especially when you have no time. Because these are also the notes that helped me clinch top tech offers - they definitely work. For more tips on coding interview preparation, refer to my [full coding interview preparation guide](./coding-interview-prep.md) here. ### Try out mock coding interviews (with Google and Facebook engineers) Coding right in front of your interviewer can be a nerve-wracking experience especially if you have never done it before - which is why getting hands-on experience is so important. [interviewing.io](https://iio.sh/r/DMCa) is currently the best mock technical interview resource in the market. It allows you to book mock coding interviews with real Google and Facebook engineers, albeit anonymously. You could even book interviews for specific roles like Mobile, Front End, Engineering Management. Even better - if you want to have an easier transition into real world coding interview - you could view recorded interviews and see what phone interviews are like. Moreover, if you were to do well on your mock interviews, you will be able to unlock the "jobs page" which allows you to book interviews directly with top companies like Uber, Lyft, Quora, Asana and more. I've used [interviewing.io](https://iio.sh/r/DMCa) both as an interviewer and an interviewee and found the experience to be excellent. ## Prepare for the system design interview If you are a mid or senior-level candidate, you may expect system design questions as part of your technical interview. They aren't covered adequately by LeetCode and good resources are still harder to come by. The objective of system design interviews is to evaluate a candidate's skill at designing real-world software systems involving multiple components. ### Utilize the best system design interview preparation resources Some of the best system design interview preparation resources include: 1. [ByteByteGo](https://bytebytego.com?fpr=techinterviewhandbook) - This is a new System Design course by Alex Xu, author of the System Design Interview books, a bestseller on Amazon. The course covers system designs basics, then goes into deep dives of the design of over 10 famous common products (e.g. [Designing YouTube](https://bytebytego.com/courses/system-design-interview/design-youtube), Facebook Newsfeed, etc) and multiple big data and storage systems (e.g. [Designing a Chat System](https://bytebytego.com/courses/system-design-interview/design-a-chat-system)). For each deep dive, concepts are explained and comprehensive diagrams are used, making it very approachable for any seniority level. 1. ["Grokking the System Design Interview" by Design Gurus](https://www.designgurus.io/course/grokking-the-system-design-interview?aff=kJSIoU) - This is probably the most famous system design interview course on the internet and what makes it different from most other courses out there is that it is purely text-based, which is great for people who prefer reading over watching videos (such as myself!). It contains a repository of the popular system design problems along with a glossary of system design basics. I've personally completed this course and have recommended many others to use this. Highly recommended! 1. ["System Design Interview Course" by Exponent](https://www.tryexponent.com/courses/system-design-interviews?ref=techinterviewhandbook) - This course covers system designs basics and has a huge database of popular system design questions with videos of mock interviews. Some of the questions have text answers and a database schema and APIs for reference (which I find helpful). While the subscription might be a little pricey for just the system design interviews content, they also offer quality technical content for [Data Structures](https://www.tryexponent.com/courses/swe-practice?ref=techinterviewhandbook), [Algorithms](https://www.tryexponent.com/courses/algorithms?ref=techinterviewhandbook) and [Behavioral Interviews](https://www.tryexponent.com/courses/behavioral?ref=techinterviewhandbook). The convenience of a one-stop platform which covers all aspects of technical interview preparation is very enticing. 1. ["Grokking the Advanced System Design Interview" by Design Gurus](https://www.designgurus.io/course/grokking-the-advanced-system-design-interview?aff=kJSIoU) - I haven't tried this but it's by the same people who created "Grokking the System Design Interview", so it should be good! In my opinion you probably wouldn't need this unless you're very senior or going for a specialist position. [Check out other Systems Design preparation guides and resources here.](./system-design.md) ## Prepare for the behavioral interview Every top tech company has at least one round of behavioral interviews for software engineers. Typically, behavioral interviews for software engineers include: - Sharing about details of previous experiences on resume - Providing examples of past situations and behavior that demonstrate certain behavioral attributes (e.g. conflict management skills, being data-driven) - Sharing of ambitions and career plans As much as these interviews seem "fluffy" or unstructured, there is actually a structured way to prepare for behavioral interviews: ### 1. Know the STAR format for answering them The **STAR** format helps you to organize your answers to behavioral questions. This is most applicable to questions that require you to recount past experiences or behavior. - **Situation**: Share details about the situation that gave rise to the task - **Task**: Explain what you needed to achieve or the problems you had to solve; focus on the - Scope - Severity - Specific benchmarks/outcomes required - **Action**: Explain what you did to meet your objectives, describing options you had and how you made decisions - **Results**: Describe the outcome of your actions and what you learnt Read more: [The STAR format for answering behavioral questions](https://en.wikipedia.org/wiki/Situation,_task,_action,_result) ### 2. Practice the most common behavioral questions for software engineers Refer to the [top 30 most common behavioral questions](./behavioral-interview-questions.md) for Software Engineers For more tips on behavioral interview preparation, refer to my [full behavioral interview preparation guide](./behavioral-interview.md) here. ## Negotiating the software engineer offer package Finally, the last thing you absolutely need to prepare for before your interview is salary negotiation for software engineers. At any point during the interview process, conversation about salary may crop up. We also have in-depth guides about [negotiation strategies](./negotiation.md) and [software engineer compensation](./understanding-compensation.md). And that is all from me - for more detail on each step of the software engineer interview preparation process, do dive into each topic within my handbook through the sidebar or by navigating to the next page! ================================================ FILE: apps/website/contents/system-design.md ================================================ --- id: system-design title: System design interview guide for Software Engineers description: How to prepare for system design interviews for Software Engineers keywords: [ system design interview guide, how to prepare for system design interview, system design interview software engineer, ] sidebar_label: System design preparation guide --- The objective of system design interviews is to evaluate a candidate's skill at designing real-world software systems involving multiple components. System design questions are typically given to more senior candidates (with a few years of experience). Interns aren't typically given system design questions as it is hard to expect interns to have sufficient and relevant industry experience to answer this type of questions well. ## Types of system design interviews System design questions can come in different formats: - **Back end / distributed system design**: Candidates are asked to design systems that work across multiple servers or data centers. Topics include back end architecture, database schema design, data replication, fault tolerance, message queues, consistency models, and more. - **API system design**: Design the APIs within a large system, possibly HTTP APIs (e.g. REST), or methods within a software component. - **Object-oriented design**: Object-oriented design interviews focus on designing classes, objects, and their relationships. Candidates are often asked to create class diagrams, define interfaces, and discuss design patterns. - **Front end system design**: Design the architecture of complex client applications or UI components. There's more emphasis on what goes on in the client and API design between the client and the server. As software engineers, the most common type of system design you will encounter is the back end / distributed system design type. Some common back end system design interview questions include: - Design a URL shortener (e.g. Bitly) - Design a social media website (e.g. Twitter) - Design a video watching website (e.g. YouTube) - Design a chatting service (e.g. Telegram, Slack, Discord) - Design a file sharing service (e.g. Google Drive, Dropbox) - Design a ride sharing service (e.g. Uber, Lyft) - Design a photo sharing service (e.g. Flickr, Pinterest) - Design an e-commerce website (e.g. Amazon, eBay) - Design a jobs portal (e.g. LinkedIn, Indeed) - Design a web crawler (e.g. Google) ## Quality resources - ["Front End System Design Playbook" by GreatFrontEnd](https://www.greatfrontend.com/front-end-system-design-playbook?fpr=yangshun): A free system design guidebook by yours truly, focused on system design for the front end applications, e.g. how to design [Facebook's News Feed](https://www.greatfrontend.com/questions/system-design/news-feed-facebook?format=system-design), [Google autocomplete search](https://www.greatfrontend.com/questions/system-design/autocomplete?format=system-design), Image Carousels and more. - [System Design in a Hurry](https://www.hellointerview.com/learn/system-design/in-a-hurry/introduction): Authored by ex- Meta and Amazon engineers, covers the basics of delivery, high-level concepts, and core technologies. Worked "common problems" walk you through various design decisions in real problems and how to navigate them. It's updated frequently and most of the content is high quality and free. Many users think it's a crime for it to be so good yet free. - [System Design Newsletter](https://newsletter.systemdesign.one/): Weekly newsletter on system design. Also get the powerful system design template for FREE. - [ByteByteGo](https://bytebytego.com?fpr=techinterviewhandbook): This is a new System Design course by Alex Xu, author of the System Design Interview books, a bestseller on Amazon. The course covers system designs basics, then goes into deep dives of the design of over 10 famous common products (e.g. [Designing YouTube](https://bytebytego.com/courses/system-design-interview/design-youtube?fpr=techinterviewhandbook), Facebook Newsfeed, etc) and multiple big data and storage systems (e.g. [Designing a Chat System](https://bytebytego.com/courses/system-design-interview/design-a-chat-system?fpr=techinterviewhandbook)). For each deep dive, concepts are explained and comprehensive diagrams are used, making it very approachable regardless of seniority level. - ["Grokking the System Design Interview" by Design Gurus](https://www.designgurus.io/course/grokking-the-system-design-interview?aff=kJSIoU): This is probably the most famous system design interview course on the internet and what makes it different from most other courses out there is that it is purely text-based, which is great for people who prefer reading over watching videos (such as myself!). It contains a repository of the popular system design problems along with a glossary of system design basics. I've personally completed this course and highly recommended many others to use this. - ["Grokking the Advanced System Design Interview" by Design Gurus](https://www.designgurus.io/course/grokking-the-advanced-system-design-interview?aff=kJSIoU): I haven't tried this but it's by the same people who created "Grokking the System Design Interview", so it should be good! In my opinion you probably wouldn't need this unless you're very senior or going for a specialist position. - ["System Design Interview Handbook" by Educative](https://www.systemdesignhandbook.com/system-design-interview-handbook/): A complete, interview-focused guide that teaches you how to reason, communicate, and design scalable systems the way top tech companies expect. - ["Grokking Modern System Design Interview" course by Educative](https://www.educative.io/courses/grokking-the-system-design-interview?aff=x23W): A structured course by ex-FAANG engineers that teaches you how to design scalable systems with clarity and confidence for modern tech interviews. Contains many system design topics along with case studies. - ["Best of System Design" package by Design Gurus](https://www.designgurus.io/bundle/buy-both-system-design-courses?aff=kJSIoU): This bundle allows you to purchase both System Design interview courses by Design Gurus at a discount. Best of all, it's lifetime and not subscription-based. - ["System Design Interview Course" by Exponent](https://www.tryexponent.com/courses/system-design-interviews?ref=techinterviewhandbook): This course covers system designs basics and has a huge database of popular system design questions with videos of mock interviews. Some of the questions have text answers and a database schema and APIs for reference (which I find helpful). While the subscription might be a little pricey for just the system design interviews content, they also offer quality technical content for [Data Structures](https://www.tryexponent.com/courses/swe-practice?ref=techinterviewhandbook), [Algorithms](https://www.tryexponent.com/courses/algorithms?ref=techinterviewhandbook) and [Behavioral Interviews](https://www.tryexponent.com/courses/behavioral?ref=techinterviewhandbook). The convenience of a one-stop platform which covers all aspects of technical interview preparation is very enticing. - ["System Design Playlist" by Gaurav Sen](https://www.youtube.com/watch?v=xpDnVSmNFX0&feature=youtu.be): Gaurav Sen is a popular YouTuber who has gained a lot of recognition for his system design videos. His playlist on System Design provides a comprehensive guide for software engineers who are preparing for technical interviews or want to learn more about how to design scalable systems. The playlist consists of multiple videos, each video covering a different topic related to system design. The videos are designed in a way that simplifies complex topics and makes it easy to understand for beginners. ## Free resources - [System Design Primer](https://github.com/donnemartin/system-design-primer): Most comprehensive resource on system design out there. Recommended only if you have a ton of time to spare. - [System Design Interview](https://github.com/checkcheckzz/system-design-interview): Contains many links to tips about system design, system design-related topics and engineering blogs of famous companies. - [System Design Cheatsheet](https://gist.github.com/vasanthk/485d1c25737e8e72759f): Brief and concise content. Serves as a good revision right before your system design interview. - [System Design Roadmap](https://roadmap.sh/system-design): Step-by-step guide that includes links to articles and videos on learning essential topics. ## Books - [System Design Interview – An insider's guide, Second Edition](https://www.amazon.com/System-Design-Interview-insiders-Second/dp/B08CMF2CQF): Beginner friendly resource to learn about system design, the content is easy to read and understand. ================================================ FILE: apps/website/contents/understanding-compensation.md ================================================ --- id: understanding-compensation title: Understanding compensation --- import InDocAd from './\_components/InDocAd'; Compensation is one of the largest factors when it comes to deciding between job offers. This section gives you a breakdown of the common components of compensation in the tech industry. In most companies, your compensation will consist of base salary, a performance bonus and equity/stocks. For compensation data, check out [Levels.fyi](https://www.levels.fyi?ref=TechInterviewHandbook&utm_source=techinterviewhandbook&utm_medium=referral&utm_content=website_negotiation). ## Base salary Base salary is a fixed amount of salary you get for showing up at work and is unaffected by how well the company is performing or the industry is doing. It is the only non-variable component of your compensation. Fresh graduates in the Bay Area can usually expect to get a base salary of above USD 100,000 (before taxes). The salary for fresh graduates at Facebook/Google is known to be in the USD 100,000 - 150,000 range. Startups usually offer a bit higher for fresh graduate (USD 120,000 - 130,000) to make up for the lack of liquidity of the equity grant (not yet real cash). Base salary doesn't increase linearly as you become more senior; it will taper off eventually. As employees become increasingly senior within the company, the higher the proportion of their compensation comes from company-dependent factors such as bonus and equity. This is because senior employees are expected to influence the people around them and drive the company forward. A senior employee's performance will be based on how well the company does as a whole; the individual factor will not be as much. There are some exceptions to the system. Companies like Netflix pay top of the industry (sometimes even more than Facebook/Google) and give employees the option to receive their entire compensation as base salary, that is, to convert the equity component into their base. For the risk-adverse, this is a great choice. ## Bonus Bonuses are usually paid on a semi-annual basis and are typically dependent on a few factors - level of seniority, individual performance in that time period, company performance in that time period. - **Level of seniority** - This is usually a multiplier of the base salary and the multiplier increases as the employee moves up the ranks - **Individual performance** - This is a multiplier of how well an employee performed in that time period. E.g. meeting expectations results in a 100% multiplier and exceeding expectations results in a >100% multiplier. Companies like Facebook and Apple reward their top performers handsomely, and the multiplier can go up to 300% for the extremely high-performing employees - **Company performance** - How well the company is doing. This multiplier will be the same for all employees ### Examples Bob is a Software Engineer fresh out of college. His base salary is $100,000, is a fresh grad (seniority multiplier: 10%), crushed expectations for the half (individual performance multiplier: 200%) and his company did pretty well (company performance multiplier: 120%). For that half, his bonus will be as follows: **Bonus:** 100,000 x 50% (half a year) x 10% (seniority) x 200% (individual performance) x 120% (company performance) = 12000 Alice is an Engineering Manager with 10 years of professional experience. Her base salary is $220,000, is an experienced engineering manager (seniority multiplier: 20%), exceeded expectations for the half (individual performance multiplier: 150%) and her company did pretty awesome (company performance multiplier: 130%). For that half, her bonus will be as follows: **Bonus:** 220,000 x 50% (half a year) x 20% (seniority) x 150% (individual performance) x 130% (company performance) = 42900 Hence the amount of bonus you receive can be highly variable and senior employees get a higher proportion of their total compensation from bonuses. ## Equity/stocks Equity is what differentiates a tech job from a non-tech one. Equity means a share of the company; this signifies ownership and motivates employees to work in the best interests of the company. They can be a significant portion of one's compensation, sometimes even more than the base salary, especially for senior employees. Equity usually vests (becomes available to you) over a period of time (typically 4 years) and can vest equally every month/quarter/year. A vesting cliff means the minimum period of time before your vesting begins. For example, if you are granted 4,800 shares over a 4 year schedule with a 1 year cliff, and monthly vesting, you will get 1,200 shares at the end of your first year and 100 shares every month thereafter for the subsequent 3 years. Until the company goes public (IPO) or gets acquired, the equity is usually not worth anything. However, there are instances where you can sell your stocks internally even though the company hasn't gone public. Be mindful of what you are getting yourself into! Not all equity is treated equally. Depending on the company you join and which stage that company is at, you may receive one of the following types: stock options or stock grants. ### Stock options Stock options are typically given by mid-stage companies. Stock options are different from stocks, which represents the immediate ownership of a company! Stock options are the **option/right** to purchase stocks at a given strike price, hence it's not free. However, the cost of each stock is usually quite low and fixed at a strike price, which is equal to the fair market value of the stock when it was granted to you. You are guaranteed to be able to purchase the stock at that price regardless of future increases. When you leave a company, there is an exercise window (deadline given for you to exercise your options before they are gone), so it is important to have enough liquid cash to purchase them when planning a departure. ### Stock grants A stock grant is commonly referred to as a Restricted Stock Unit (RSU) and it means you possess the stock immediately. If the company is public, you can sell them during defined trading windows. More reading on the topic can be done on the [equity compensation guide](https://github.com/jlevy/og-equity-compensation) and the article ["What I Wish I'd Known About Equity Before Joining A Unicorn"](https://gist.github.com/yossorion/4965df74fd6da6cdc280ec57e83a202d). ## Signing bonus This is a one-time lump sum that is paid to you when you join a company. This amount is typically in the range of USD 10,000 to USD 20,000 but can even go up to USD 50,000 (Google) and USD 100,000 (Facebook). There can be conditions attached to signing bonuses, such as having to return a pro-rated amount if an employee leaves before the one-year mark. Make sure you are aware of them before you sign the offer. ## Misc bonuses/perks While these perks are not exactly cash, they can help you save money which is almost equivalent to getting compensated more. Do find out more about these from your recruiters if you get the chance. - **Free meals** - Food is not exactly cheap in the Bay Area and having some meals provided on weekdays can result in saving few thousand dollars a year and hours spent on travelling out to get food - **Relocation bonus** - Helpful if you are moving from abroad. This can partially offset costs incurred during relocation - **Health and dental insurance/plans** - Companies often partner with insurance companies to provide employees with health and dental plans. These can amount to a few thousand dollars worth annually and is especially useful in locations where healthcare is expensive - **Shuttle service** - Public transportation in the Bay Area is not that great and the most common form of commute is driving. Being able to take a shuttle service helps in saving money on gas, transport, and freeing up your mind to do other things during the commute ## Examples Here's crowdsourced data from Google and Facebook regarding the salaries for the various levels: ### Google | Level | Total (USD) | Base | Bonus | Stock (/yr) | | ----------------------- | ----------- | -------- | -------- | ----------- | | L3 (Entry Level) | $191,000 | $131,000 | $21,000 | $39,000 | | L4 (SWE) | $267,000 | $158,000 | $28,000 | $81,000 | | L5 (Senior SWE) | $355,000 | $188,000 | $37,000 | $130,000 | | L6 (Staff SWE) | $489,000 | $223,000 | $50,000 | $214,000 | | L7 (Senior Staff SWE) | $672,000 | $263,000 | $79,000 | $330,000 | | L8 (Principal Engineer) | $1,020,000 | $331,000 | $119,000 | $572,000 | _Data as of Aug 2021. Source: [Levels.fyi](https://www.levels.fyi/company/Google/salaries/Software-Engineer/?ref=TechInterviewHandbook&utm_source=techinterviewhandbook&utm_medium=referral&utm_content=website_negotiation)_ ### Facebook | Level | Total (USD) | Base | Bonus | Stock (/yr) | | --------------------- | ----------- | -------- | ------- | ----------- | | E3 (Entry Level) | $180,000 | $122,000 | $14,000 | $43,000 | | E4 (SWE) | $267,000 | $162,000 | $18,000 | $85,000 | | E5 (Senior SWE) | $390,000 | $197,000 | $35,000 | $157,000 | | E6 (Staff SWE) | $598,000 | $234,000 | $54,000 | $309,000 | | E7 (Senior Staff SWE) | $921,000 | $272,000 | $81,000 | $567,000 | _Data as of Aug 2021. Source: [Levels.fyi](https://www.levels.fyi/company/Facebook/salaries/Software-Engineer/?ref=TechInterviewHandbook&utm_source=techinterviewhandbook&utm_medium=referral&utm_content=website_negotiation)_ ================================================ FILE: apps/website/docusaurus.config.js ================================================ module.exports = { title: 'Tech Interview Handbook', tagline: 'Free curated interview preparation materials for busy people', url: 'https://www.techinterviewhandbook.org', baseUrl: '/', trailingSlash: true, favicon: 'img/favicon.png', organizationName: 'yangshun', projectName: 'tech-interview-handbook', themeConfig: { announcementBar: { id: 'gfe-1', // Increment on change, backgroundColor: '#7063f3', content: `We collaborated with engineers from Google and Amazon and built the best front end interview preparation platform. Check out GreatFrontEnd today!`, isCloseable: false, }, prism: { theme: require('prism-react-renderer/themes/github'), darkTheme: require('prism-react-renderer/themes/dracula'), }, navbar: { title: 'Tech Interview Handbook', logo: { alt: 'Tech Interview Handbook Logo', src: 'img/logo.svg', }, hideOnScroll: true, items: [ { label: 'Start reading', href: '/software-engineering-interview-guide/', position: 'left', }, { label: 'Coding', href: '/coding-interview-prep/', }, { label: 'Algorithms', href: '/algorithms/study-cheatsheet', }, { label: 'Blog', to: 'blog', position: 'left' }, { label: 'Grind 75', href: 'https://www.techinterviewhandbook.org/grind75/', position: 'left', }, { label: 'Front End', href: 'https://www.frontendinterviewhandbook.com', position: 'left', }, { href: 'https://github.com/yangshun/tech-interview-handbook', position: 'right', className: 'navbar-icon', 'aria-label': 'GitHub repository', html: ` `, }, { href: 'https://linkedin.com/in/yangshun', position: 'right', className: 'navbar-icon', 'aria-label': 'LinkedIn', html: ``, }, ], }, footer: { style: 'dark', copyright: `Copyright © ${new Date().getFullYear()} Tech Interview Handbook. Built with Docusaurus.`, links: [ { title: 'General', items: [ { label: 'Start reading', href: '/software-engineering-interview-guide/', }, { label: 'Prepare a FAANG-ready resume', href: '/resume/', }, { label: 'Algorithms cheatsheets', href: '/algorithms/study-cheatsheet', }, { label: 'Blog', href: '/blog', }, ], }, { title: 'Interviews', items: [ { label: 'Coding interviews', href: '/coding-interview-prep/', }, { label: 'Coding interview study plan', href: '/coding-interview-study-plan/', }, { label: 'System design interviews', href: '/system-design/', }, { label: 'Behavioral interviews', href: '/behavioral-interview/', }, ], }, { title: 'Community', items: [ { label: 'GitHub', href: 'https://github.com/yangshun/tech-interview-handbook', }, { label: 'Discord', href: 'https://discord.com/invite/usMqNaPczq', }, { label: 'Telegram', href: 'https://t.me/techinterviewhandbook', }, { label: 'Twitter', href: 'https://twitter.com/techinterviewhb', }, ], }, { title: 'More', items: [ { label: 'Grind 75', href: 'https://www.techinterviewhandbook.org/grind75/', }, { label: 'Front End Interview Handbook', href: 'https://www.frontendinterviewhandbook.com', }, { label: 'Contact us', href: 'mailto:contact@techinterviewhandbook.org', }, { label: 'Facebook', href: 'https://www.facebook.com/techinterviewhandbook', }, ], }, ], }, algolia: { appId: 'Y09P1J4IPV', apiKey: 'e12588cbae68d752469921cc46e9cb66', indexName: 'techinterviewhandbook', }, docs: { sidebar: { hideable: true, }, }, }, presets: [ [ '@docusaurus/preset-classic', { docs: { path: './contents', routeBasePath: '/', sidebarPath: require.resolve('./sidebars.js'), // ShowLastUpdateAuthor: true, showLastUpdateTime: true, }, theme: { customCss: require.resolve('./src/css/custom.css'), }, gtag: { trackingID: 'G-9F86L298EX', }, blog: { blogSidebarCount: 15, }, sitemap: { ignorePatterns: [ '/blog/', '/blog/a-glimpse-into-front-end-interviews/', '/blog/are-front-end-development-skills-enough-for-a-career/', '/blog/facebook-career-questions-and-answers/', '/blog/importance-of-communicating-effectively-as-engineers/', '/blog/front-end-career-questions/', '/blog/how-to-have-successful-software-engineering-internship/', '/blog/tags/career/', '/blog/tags/meta/', '/blog/tags/facebook/', '/algorithms/oop/', '/search/', '/resume-overview/', '/blog/archive/', ], }, }, ], ], plugins: [ [ '@docusaurus/plugin-google-gtag', { id: 'universal-analytics', trackingID: 'UA-44622716-2', anonymizeIP: true, }, ], ], }; ================================================ FILE: apps/website/experimental/front-end/README.md ================================================ # Front-end Job Interview Questions Front-end Job Interview Questions have been migrated [here](https://github.com/yangshun/front-end-interview-handbook). ================================================ FILE: apps/website/experimental/topics.md ================================================ --- id: topics title: Topics --- ## Arrays ## Strings - Prefix trees (Tries) - Suffix trees - Suffix arrays - KMP - Rabin-Karp - Boyer-Moore ## Sorting - Bubble sort - Insertion sort - Merge sort - Quick sort - Selection sort - Bucket sort - Radix sort - Counting sort ## Linked Lists ## Stacks ## Queues ## Hash tables - Collision resolution algorithms ## Trees - BFS - DFS (inorder, postorder, preorder) - Height ## Binary Search Trees - Insert node - Delete a node - Find element in BST - Find min, max element in BST - Get successor element in tree - Check if a binary tree is a BST or not ## Heaps / Priority Queues - Insert - Bubble up - Extract max - Remove - Heapify - Heap sort ## Graphs - Various implementations - Adjacency matrix - Adjacency list - Adjacency map - Single-source shortest path - Dijkstra - Bellman-Ford - Topo sort - MST - Prim algorithm - Kruskal's algorithm - Union Find Data Structure - Count connected components in a graph - List strongly connected components in a graph - Check for bipartite graph ## Dynamic Programming - Count Change - 0-1 Knapsack ## System Design - http://www.hiredintech.com/system-design/ - https://www.quora.com/How-do-I-prepare-to-answer-design-questions-in-a-technical-interview?redirected_qid=1500023 - http://blog.gainlo.co/index.php/2015/10/22/8-things-you-need-to-know-before-system-design-interviews/ - https://github.com/donnemartin/system-design-primer - https://github.com/jwasham/coding-interview-university/blob/master/extras/cheat%20sheets/system-design.pdf ================================================ FILE: apps/website/experimental/utilities/javascript/binToInt.js ================================================ // Does not handle negative binary numbers. function binToInt(binary) { let res = 0; for (let i = 0; i < binary.length; i++) { res = res * 2 + +binary[i]; } return res; } console.log(binToInt('0') === parseInt('0', 2) && parseInt('0', 2) === 0); console.log(binToInt('1') === parseInt('1', 2) && parseInt('1', 2) === 1); console.log(binToInt('10') === parseInt('10', 2) && parseInt('10', 2) === 2); console.log(binToInt('11') === parseInt('11', 2) && parseInt('11', 2) === 3); console.log(binToInt('101') === parseInt('101', 2) && parseInt('101', 2) === 5); console.log( binToInt('1100011') === parseInt('1100011', 2) && parseInt('1100011', 2) === 99, ); ================================================ FILE: apps/website/experimental/utilities/javascript/binarySearch.js ================================================ function binarySearch(arr, target) { let left = 0; let right = arr.length - 1; while (left <= right) { const mid = left + Math.floor((right - left) / 2); if (arr[mid] === target) { return mid; } if (arr[mid] < target) { left = mid + 1; } else { right = mid - 1; } } return -1; } console.log(binarySearch([1, 2, 3, 10], 1) === 0); console.log(binarySearch([1, 2, 3, 10], 2) === 1); console.log(binarySearch([1, 2, 3, 10], 3) === 2); console.log(binarySearch([1, 2, 3, 10], 10) === 3); console.log(binarySearch([1, 2, 3, 10], 9) === -1); console.log(binarySearch([1, 2, 3, 10], 4) === -1); console.log(binarySearch([1, 2, 3, 10], 0) === -1); console.log(binarySearch([1, 2, 3, 10], 11) === -1); console.log(binarySearch([5, 7, 8, 10], 3) === -1); ================================================ FILE: apps/website/experimental/utilities/javascript/deepEqual.js ================================================ function deepEqual(val1, val2) { if (typeof val1 !== typeof val2) { return false; } // Array comparison. if (Array.isArray(val1) && Array.isArray(val2)) { if (val1.length !== val2.length) { return false; } for (let i = 0; i < val1.length; i++) { if (!deepEqual(val1[i], val2[i])) { return false; } } return true; } // Object comparison. if ( typeof val1 === 'object' && typeof val2 === 'object' && val1 !== null && val2 !== null ) { const keys1 = Object.keys(val1), keys2 = Object.keys(val2); if (keys1.length !== keys2.length) { return false; } for (let i = 0; i < keys1.length; i++) { if (!deepEqual(val1[keys1[i]], val2[keys2[i]])) { return false; } } return true; } // Primitive comparison. return val1 === val2; } module.exports = deepEqual; ================================================ FILE: apps/website/experimental/utilities/javascript/graphTopoSort.js ================================================ function graphTopoSort(numberNodes, edges) { const nodes = new Map(); const order = []; const queue = []; for (let i = 0; i < numberNodes; i++) { nodes.set(i, { in: 0, out: new Set() }); } edges.forEach((edge) => { const [node_id, pre_id] = edge; nodes.get(node_id).in += 1; nodes.get(pre_id).out.add(node_id); }); for (let [node_id, value] of nodes.entries()) { if (value.in === 0) { queue.push(node_id); } } while (queue.length) { const node_id = queue.shift(); for (let outgoing_id of nodes.get(node_id).out) { nodes.get(outgoing_id).in -= 1; if (nodes.get(outgoing_id).in === 0) { queue.push(outgoing_id); } } order.push(node_id); } return order.length == numberNodes ? order : []; } console.log( graphTopoSort(3, [ [0, 1], [0, 2], ]), ); ================================================ FILE: apps/website/experimental/utilities/javascript/intToBin.js ================================================ // Does not handle negative numbers. function intToBin(number) { if (number === 0) { return '0'; } let res = ''; while (number > 0) { res = String(number % 2) + res; number = parseInt(number / 2, 10); } return res; } console.log(intToBin(0) === (0).toString(2) && (0).toString(2) === '0'); console.log(intToBin(1) === (1).toString(2) && (1).toString(2) === '1'); console.log(intToBin(2) === (2).toString(2) && (2).toString(2) === '10'); console.log(intToBin(3) === (3).toString(2) && (3).toString(2) === '11'); console.log(intToBin(5) === (5).toString(2) && (5).toString(2) === '101'); console.log( intToBin(99) === (99).toString(2) && (99).toString(2) === '1100011', ); ================================================ FILE: apps/website/experimental/utilities/javascript/intervalsIntersect.js ================================================ // Interval: [start, end]. function intervalsIntersect(a, b) { return a[0] < b[1] && b[0] < a[1]; } console.log(intervalsIntersect([1, 2], [3, 4]) === false); console.log(intervalsIntersect([1, 2], [2, 4]) === false); console.log(intervalsIntersect([1, 2], [1, 4]) === true); console.log(intervalsIntersect([1, 2], [0, 4]) === true); console.log(intervalsIntersect([1, 2], [0, 2]) === true); console.log(intervalsIntersect([1, 2], [0, 1.5]) === true); console.log(intervalsIntersect([3, 4], [1, 2]) === false); console.log(intervalsIntersect([2, 4], [1, 2]) === false); console.log(intervalsIntersect([1, 4], [1, 2]) === true); console.log(intervalsIntersect([0, 4], [1, 2]) === true); console.log(intervalsIntersect([0, 2], [1, 2]) === true); console.log(intervalsIntersect([0, 1.5], [1, 2]) === true); ================================================ FILE: apps/website/experimental/utilities/javascript/intervalsMerge.js ================================================ // Interval: [start, end]. // Merges two overlapping intervals into one. function intervalsMerge(a, b) { return [Math.min(a[0], b[0]), Math.max(a[1], b[1])]; } const deepEqual = require('./deepEqual'); console.log(deepEqual(intervalsMerge([1, 2], [1, 4]), [1, 4])); console.log(deepEqual(intervalsMerge([1, 2], [0, 4]), [0, 4])); console.log(deepEqual(intervalsMerge([1, 2], [0, 2]), [0, 2])); console.log(deepEqual(intervalsMerge([1, 2], [0, 1.5]), [0, 2])); console.log(deepEqual(intervalsMerge([1, 4], [1, 2]), [1, 4])); console.log(deepEqual(intervalsMerge([0, 4], [1, 2]), [0, 4])); console.log(deepEqual(intervalsMerge([0, 2], [1, 2]), [0, 2])); console.log(deepEqual(intervalsMerge([0, 1.5], [1, 2]), [0, 2])); ================================================ FILE: apps/website/experimental/utilities/javascript/isSubsequence.js ================================================ function isSubsequence(s, t) { if (s.length > t.length) { return false; } let matchedLength = 0; for (let i = 0; i < t.length; i++) { if (matchedLength < s.length && s[matchedLength] === t[i]) { matchedLength += 1; } } return matchedLength === s.length; } console.log(isSubsequence('abc', 'abcde') === true); console.log(isSubsequence('abd', 'abcde') === true); console.log(isSubsequence('abf', 'abcde') === false); console.log(isSubsequence('abef', 'abcde') === false); console.log(isSubsequence('abcdef', 'abcde') === false); console.log(isSubsequence('a', 'abcde') === true); ================================================ FILE: apps/website/experimental/utilities/javascript/matrixClone.js ================================================ function matrixClone(matrix, defaultValue) { return matrix.map((row) => { return defaultValue === undefined ? row.slice(0) : Array(row.length).fill(defaultValue); }); } const deepEqual = require('./deepEqual'); // Test clone. const a = [ [1, 2], [1, 4], ]; console.log( deepEqual(matrixClone(a), [ [1, 2], [1, 4], ]), ); a[0][0] = 4; console.log( deepEqual(matrixClone(a), [ [1, 2], [1, 4], ]) === false, ); console.log(deepEqual(matrixClone([[1]]), [[1]])); // Test clone with default value. console.log( deepEqual( matrixClone( [ [1, 2], [1, 4], ], 1, ), [ [1, 1], [1, 1], ], ), ); console.log( deepEqual( matrixClone( [ [1, 2], [1, 4], ], null, ), [ [null, null], [null, null], ], ), ); ================================================ FILE: apps/website/experimental/utilities/javascript/matrixTranspose.js ================================================ function matrixTranspose(matrix) { return matrix[0].map((col, i) => matrix.map((row) => row[i])); } const deepEqual = require('./deepEqual'); console.log(deepEqual(matrixTranspose([[1]]), [[1]])); console.log(deepEqual(matrixTranspose([[1, 2]]), [[1], [2]])); console.log( deepEqual( matrixTranspose([ [1, 2], [1, 4], ]), [ [1, 1], [2, 4], ], ), ); console.log( deepEqual( matrixTranspose([ [1, 2, 3], [4, 5, 6], ]), [ [1, 4], [2, 5], [3, 6], ], ), ); ================================================ FILE: apps/website/experimental/utilities/javascript/matrixTraverse.js ================================================ function traverse(matrix) { const DIRECTIONS = [ [0, 1], [0, -1], [1, 0], [-1, 0], ]; const rows = matrix.length; const cols = matrix[0].length; const visited = matrix.map((row) => Array(row.length).fill(false)); function dfs(i, j) { if (visited[i][j]) { return; } visited[i][j] = true; DIRECTIONS.forEach((dir) => { const row = i + dir[0], col = j + dir[1]; // Boundary check. if (row < 0 || row >= rows || col < 0 || col >= cols) { return; } // Valid neighbor check. if (matrix[row][col] !== 1) { return; } dfs(row, col); }); } for (let i = 0; i < rows; i++) { for (let j = 0; j < cols; j++) { dfs(i, j); } } } ================================================ FILE: apps/website/experimental/utilities/javascript/mergeSort.js ================================================ function mergeSort(arr) { if (arr.length < 2) { // Arrays of length 0 or 1 are sorted by definition. return arr; } const left = arr.slice(0, Math.floor(arr.length / 2)); const right = arr.slice(Math.floor(arr.length / 2), Math.floor(arr.length)); return merge(mergeSort(left), mergeSort(right)); } function merge(arr1, arr2) { const merged = []; let i = 0, j = 0; while (i < arr1.length && j < arr2.length) { if (arr1[i] <= arr2[j]) { merged.push(arr1[i]); i++; } else if (arr2[j] < arr1[i]) { merged.push(arr2[j]); j++; } } merged.push(...arr1.slice(i), ...arr2.slice(j)); return merged; } const deepEqual = require('./deepEqual'); console.log(deepEqual(mergeSort([]), [])); console.log(deepEqual(mergeSort([1]), [1])); console.log(deepEqual(mergeSort([2, 1]), [1, 2])); console.log(deepEqual(mergeSort([7, 2, 4, 3, 1, 2]), [1, 2, 2, 3, 4, 7])); console.log(deepEqual(mergeSort([1, 2, 3, 4, 5, 0]), [0, 1, 2, 3, 4, 5])); console.log( deepEqual( mergeSort([10, 9, 8, 7, 6, 5, 4, 3, 2, 1]), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], ), ); console.log( deepEqual( mergeSort([98322, 3242, 876, -234, 34, 12331]), [-234, 34, 876, 3242, 12331, 98322], ), ); ================================================ FILE: apps/website/experimental/utilities/javascript/treeEqual.js ================================================ function treeEqual(node1, node2) { if (!node1 && !node2) { return true; } if (!node1 || !node2) { return false; } return ( node1.val == node2.val && treeEqual(node1.left, node2.left) && treeEqual(node1.right, node2.right) ); } ================================================ FILE: apps/website/experimental/utilities/javascript/treeMirror.js ================================================ function treeMirror(node) { if (!node) { return; } let temp = node.left; node.left = node.right; node.right = temp; treeMirror(node.left); treeMirror(node.right); } ================================================ FILE: apps/website/experimental/utilities/python/binary_search.py ================================================ def binary_search(arr, target): left = 0; right = len(arr) - 1 while left <= right: mid = left + (right - left) // 2; if arr[mid] == target: return mid elif arr[mid] < target: left = mid + 1 else: right = mid - 1 return -1 def bisect_left(arr, target): """Returns the leftmost position that `target` should go to such that the sequence remains sorted.""" left = 0 right = len(arr) while left < right: mid = (left + right) // 2 if arr[mid] < target: left = mid + 1 else: right = mid return left def bisect_right(arr, target): """Returns the rightmost position that `target` should go to such that the sequence remains sorted.""" left = 0 right = len(arr) while left < right: mid = (left + right) // 2 if arr[mid] > target: right = mid else: left = mid + 1 return left print(binary_search([1, 2, 3, 10], 1) == 0) print(binary_search([1, 2, 3, 10], 2) == 1) print(binary_search([1, 2, 3, 10], 3) == 2) print(binary_search([1, 2, 3, 10], 10) == 3) print(binary_search([1, 2, 3, 10], 9) == -1) print(binary_search([1, 2, 3, 10], 4) == -1) print(binary_search([1, 2, 3, 10], 0) == -1) print(binary_search([1, 2, 3, 10], 11) == -1) print(binary_search([5, 7, 8, 10], 3) == -1) print(bisect_left([1, 2, 3, 3, 10], 1) == 0) print(bisect_left([1, 2, 3, 3, 10], 2) == 1) print(bisect_left([1, 2, 3, 3, 10], 3) == 2) # First "3" is at index 2 print(bisect_left([1, 2, 3, 3, 10], 10) == 4) # These return a valid index despite target not being in array. print(bisect_left([1, 2, 3, 3, 10], 9) == 4) print(bisect_left([1, 2, 3, 3, 10], 0) == 0) # Insert "0" at front print(bisect_left([1, 2, 3, 3, 10], 11) == 5) # Insert "5" at back print(bisect_right([1, 2, 3, 3, 10], 1) == 1) print(bisect_right([1, 2, 3, 3, 10], 2) == 2) print(bisect_right([1, 2, 3, 3, 10], 3) == 4) # Last "3" is at index 3, so insert new "3" at index 4 print(bisect_right([1, 2, 3, 3, 10], 10) == 5) # These return a valid index despite target not being in array. print(bisect_right([1, 2, 3, 3, 10], 9) == 4) print(bisect_right([1, 2, 3, 3, 10], 0) == 0) # Insert "0" at front print(bisect_right([1, 2, 3, 3, 10], 11) == 5) # Insert "5" at back ================================================ FILE: apps/website/experimental/utilities/python/char_prime_map.py ================================================ # For mapping a lowercase character to a prime number. # Useful for checking whether two strings are anagram or permutations of each other. primes = { 'a': 2, 'b': 3, 'c': 5, 'd': 7, 'e': 11, 'f': 13, 'g': 17, 'h': 19, 'i': 23, 'j': 29, 'k': 31, 'l': 37, 'm': 41, 'n': 43, 'o': 47, 'p': 53, 'q': 59, 'r': 61, 's': 67, 't': 71, 'u': 73, 'v': 79, 'w': 83, 'x': 89, 'y': 97, 'z': 101, ' ': 103, } import functools def mul(seq): return functools.reduce(lambda a, b: a * b, seq, 1) def prime_value_of_string(string): return mul([primes[c] for c in string]) print(prime_value_of_string('abcde')) ================================================ FILE: apps/website/experimental/utilities/python/graph_dfs.py ================================================ def graph_dfs(matrix): rows, cols = len(matrix), len(matrix[0]) visited = set() directions = ((0, 1), (0, -1), (1, 0), (-1, 0)) def dfs(i, j): if (i, j) in visited: return visited.add((i, j)) # Traverse neighbors. for direction in directions: next_i, next_j = i + direction[0], j + direction[1] if 0 <= next_i < rows and 0 <= next_j < cols: # Check boundary. # Add any other checking here ^ dfs(next_i, next_j) for i in range(rows): for j in range(cols): dfs(i, j) # Follow up: # 1) Diagonal cells are considered neighbors # 2) View the matrix like Earth, right boundary is adjacent to the left boundary, top adjacent to left, etc. def graph_dfs_diagonals_and_boundary_wrap(matrix): rows, cols = len(matrix), len(matrix[0]) visited = set() # Change 1: Add 4 more diagonal directions. directions = ((0, 1), (0, -1), (1, 0), (-1, 0), (-1, -1), (1, 1), (1, -1), (-1, 1)) def dfs(i, j): if (i, j) in visited: return visited.add((i, j)) for direction in directions: # Change 2: No more boundary, use modulo to allow traversal that exceed boundaries to wrap around. next_i, next_j = (i + direction[0] + rows) % rows, (j + direction[1] + cols) % cols dfs(next_i, next_j) for i in range(rows): for j in range(cols): dfs(i, j) graph_dfs([ [1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], ]) ================================================ FILE: apps/website/experimental/utilities/python/graph_topo_sort.py ================================================ def graph_topo_sort(num_nodes, edges): from collections import deque nodes, order, queue = {}, [], deque() for node_id in range(num_nodes): nodes[node_id] = { 'in': 0, 'out': set() } for node_id, pre_id in edges: nodes[node_id]['in'] += 1 nodes[pre_id]['out'].add(node_id) for node_id in nodes.keys(): if nodes[node_id]['in'] == 0: queue.append(node_id) while len(queue): node_id = queue.pop() for outgoing_id in nodes[node_id]['out']: nodes[outgoing_id]['in'] -= 1 if nodes[outgoing_id]['in'] == 0: queue.append(outgoing_id) order.append(node_id) return order if len(order) == num_nodes else None print(graph_topo_sort(4, [[0, 1], [0, 2], [2, 1], [3, 0]])) # [1, 2, 0,3 ] ================================================ FILE: apps/website/experimental/utilities/python/heap.py ================================================ # Implements a min-heap. For max-heap, simply reverse all comparison orders. # # Note on alternate subroutine namings (used in some textbooks): # - _bubble_up = siftdown # - _bubble_down = siftup def _bubble_up(heap, i): while i > 0: parent_i = (i - 1) // 2 if heap[i] < heap[parent_i]: heap[i], heap[parent_i] = heap[parent_i], heap[i] i = parent_i continue break def _bubble_down(heap, i): startpos = i newitem = heap[i] left_i = 2 * i + 1 while left_i < len(heap): # Pick the smaller of the L and R children right_i = left_i + 1 if right_i < len(heap) and not heap[left_i] < heap[right_i]: child_i = right_i else: child_i = left_i # Break if heap invariant satisfied if heap[i] < heap[child_i]: break # Move the smaller child up. heap[i], heap[child_i] = heap[child_i], heap[i] i = child_i left_i = 2 * i + 1 def heapify(lst): for i in reversed(range(len(lst) // 2)): _bubble_down(lst, i) def heappush(heap, item): heap.append(item) _bubble_up(heap, len(heap) - 1) def heappop(heap): if len(heap) == 1: return heap.pop() min_value = heap[0] heap[0] = heap[-1] del heap[-1] _bubble_down(heap, 0) return min_value # Example usage heap = [3, 2, 1, 0] heapify(heap) print('Heap(0, 1, 2, 3):', heap) heappush(heap, 4) heappush(heap, 7) heappush(heap, 6) heappush(heap, 5) print('Heap(0, 1, 2, 3, 4, 5, 6, 7):', heap) sorted_list = [heappop(heap) for _ in range(8)] print('Heap-sorted list:', sorted_list) # Large test case, for randomized tests import random # Heapify 0 ~ 99 heap = list(range(100)) random.shuffle(heap) heapify(heap) # Push 100 ~ 199 in random order new_elems = list(range(100, 200)) random.shuffle(new_elems) for elem in new_elems: heappush(heap, elem) sorted_list = [heappop(heap) for _ in range(200)] print(sorted_list == sorted(sorted_list)) ================================================ FILE: apps/website/experimental/utilities/python/is_subsequence.py ================================================ def is_subsequence(s, t): """ :type s: str :type t: str :rtype: bool """ if len(s) > len(t): return False matched_s = 0 for char in t: if matched_s < len(s) and s[matched_s] == char: matched_s += 1 return matched_s == len(s) ================================================ FILE: apps/website/experimental/utilities/python/linked_list.py ================================================ # Singly-Linked List # # The linked list is passed around as a variable pointing to the # root node of the linked list, or None if the list is empty. class LinkedListNode: def __init__(self, value): self.value = value self.next = None def linked_list_append(linked_list, value): '''Appends a value to the end of the linked list''' node = linked_list insert_node = LinkedListNode(value) if not node: return insert_node while node.next: node = node.next node.next = insert_node return linked_list def linked_list_insert_index(linked_list, value, index): '''Inserts a value at a particular index''' node = linked_list insert_node = LinkedListNode(value) # Check if inserting at head if index == 0: insert_node.next = node return insert_node # Skip ahead for _ in range(index - 1): node = node.next if not node: raise ValueError insert_node.next = node.next node.next = insert_node return linked_list def linked_list_delete(linked_list, value): '''Deletes the first occurrence of a value in the linked list''' node = linked_list # Check if deleting at head if node.value == value: return node.next # Skip ahead while node.next: if node.next.value == value: node.next = node.next.next return linked_list node = node.next raise ValueError def linked_list_delete_index(linked_list, index): '''Deletes the element at a particular index in the linked list''' node = linked_list # Check if deleting at head if index == 0: return node.next # Skip ahead for _ in range(index - 1): node = node.next if not node: raise ValueError if not node.next: raise ValueError node.next = node.next.next return linked_list def linked_list_iter(linked_list): '''Lazy iterator over each node in the linked list''' node = linked_list while node is not None: yield node node = node.next # Append to back linked_list = None # Start with an empty linked list linked_list = linked_list_append(linked_list, 1) linked_list = linked_list_append(linked_list, 2) linked_list = linked_list_append(linked_list, 4) print([node.value for node in linked_list_iter(linked_list)]) # Insert by index linked_list = linked_list_insert_index(linked_list, 0, 0) # Front print([node.value for node in linked_list_iter(linked_list)]) linked_list = linked_list_insert_index(linked_list, 3, 3) # Back print([node.value for node in linked_list_iter(linked_list)]) # Delete "3" linked_list = linked_list_delete(linked_list, 3) print([node.value for node in linked_list_iter(linked_list)]) # Delete by index linked_list = linked_list_delete_index(linked_list, 0) print([node.value for node in linked_list_iter(linked_list)]) linked_list = linked_list_delete_index(linked_list, 1) print([node.value for node in linked_list_iter(linked_list)]) # Delete until empty linked_list = linked_list_delete_index(linked_list, 0) linked_list = linked_list_delete_index(linked_list, 0) print([node.value for node in linked_list_iter(linked_list)]) ================================================ FILE: apps/website/experimental/utilities/python/quick_select.py ================================================ ## QuickSelect -- Linear-time k-th order statistic ## (i.e. select the k-th smallest element in an unsorted array) ## https://en.wikipedia.org/wiki/Quickselect def partition(array, start, end, pivot): """Partitions by a pivot value, which might not necessarily be in the array. This variant is useful when you want to bound your recursion depth by the range of the input values, and not the length of the array.""" pivot_index = start for i in range(start, end): if array[i] <= pivot: array[i], array[pivot_index] = array[pivot_index], array[i] pivot_index += 1 return pivot_index import random def partition_first(array, start, end): """Selects the first element as pivot. Returns the index where the pivot went to. In this variant, we can guarantee that the pivot will be in its final sorted position. We need this guarantee for QuickSelect.""" if start + 1 == end: return start pivot = array[start] pivot_index = start + 1 for i in range(start + 1, end): if array[i] <= pivot: array[i], array[pivot_index] = array[pivot_index], array[i] pivot_index += 1 # Move pivot to front array[start], array[pivot_index - 1] = array[pivot_index - 1], array[start] return pivot_index - 1 def quick_select(array, k): """NOTE: k-th smallest element counts from 0!""" left = 0 right = len(array) while True: random_index = random.sample(range(left, right), 1)[0] array[left], array[random_index] = array[random_index], array[left] pivot_index = partition_first(array, left, right) if k == pivot_index: return array[pivot_index] if k < pivot_index: right = pivot_index else: left = pivot_index + 1 print(quick_select([0], 0) == 0) print(quick_select([0, 1, 2, 3, 4], 2) == 2) print(quick_select([4, 3, 2, 1, 0], 2) == 2) print(quick_select([1, 3, 4, 2, 0], 2) == 2) # Large test case, for randomized tests lst = list(range(1000)) for _ in range(10): k = random.randint(0, 999) random.shuffle(lst) print(quick_select(lst, k) == k) ================================================ FILE: apps/website/experimental/utilities/python/rabin_karp_hash.py ================================================ ## Rabin-Karp Rolling Hash ## Implementation of: https://en.wikipedia.org/wiki/Rabin%E2%80%93Karp_algorithm#Hash_function_used ## ## This rolling hash function is useful when you need to compute the hash of successive substrings ## of text. E.g. note that going from 'abcd' to 'bcde', we drop the 'a' from the back and add an 'e' ## on the right. The rolling hash function thus allows us to update the hash in-place O(1) instead of ## recomputing the full hash of the substring O(m), where m is the length of the substring. ## ## NOTE: The implementation below takes in a tuple of integers, to be as general as possible. For use ## with strings, simply take the ASCII value of each character before passing into the functions. BASE = 101 # Arbitrary prime number def rk_hash_init(tpl): '''Initializes the hash with a tuple of integers.''' return sum(n * BASE ** i for i, n in enumerate(reversed(tpl))) def rk_hash_update(curr_hash, size, add_n, rem_n): '''Updates the hash by removing an integer from the left and appending an integer to the right. curr_hash: The previous hash size: The size of the rolling window add_n: The integer appended to the right rem_n: The integer removed from the left''' return (curr_hash - (rem_n * BASE ** (size - 1))) * BASE + add_n abc_hash = rk_hash_init(tuple(map(ord, 'abc'))) # Init the hash with 'abc' print('abc:', abc_hash) bcd_hash_1 = rk_hash_update(abc_hash, 3, ord('d'), ord('a')) # Add a 'd' to the right, remove an 'a' from the left print('bcd 1:', bcd_hash_1) zbc_hash = rk_hash_init(tuple(map(ord, 'zbc'))) # Init the hash with 'zbc' print('zbc:', zbc_hash) bcd_hash_2 = rk_hash_update(zbc_hash, 3, ord('d'), ord('z')) # Add a 'd' to the right, remove a 'z' from the left print('bcd 2:', bcd_hash_2) # Notice that both hash values are the same despite arriving via different paths print(bcd_hash_1 == bcd_hash_2) ================================================ FILE: apps/website/experimental/utilities/python/tree_equal.py ================================================ def tree_equal(node1, node2): if not node1 and not node2: return True if not node1 or not node2: return False return node1.val == node2.val and \ tree_equal(node1.left, node2.left) and \ tree_equal(node1.right, node2.right) ================================================ FILE: apps/website/experimental/utilities/python/tree_mirror.py ================================================ def tree_mirror(node): if not node: return node.left, node.right = node.right, node.left tree_mirror(node.left) tree_mirror(node.right) ================================================ FILE: apps/website/experimental/utilities/python/tree_traversal.py ================================================ # Various iterative ways of traversing a tree. def inorder_traversal(root): """ :type root: TreeNode :rtype: List[int] """ if not root: return [] result = [] stack = [root] while len(stack) > 0: curr_node = stack.pop() if curr_node.left: stack.append(curr_node) stack.append(curr_node.left) curr_node.left = None else: result.append(curr_node.val) if curr_node.right: stack.append(curr_node.right) return result def preorder_traversal(root): """ :type root: TreeNode :rtype: List[int] """ if not root: return [] result = [] stack = [root] while len(stack) > 0: curr_node = stack.pop() result.append(curr_node.val) if curr_node.right: stack.append(curr_node.right) if curr_node.left: stack.append(curr_node.left) return result def postorder_traversal(root): """ :type root: TreeNode :rtype: List[int] """ if not root: return [] result = [] stack = [root] while len(stack) > 0: curr_node = stack.pop() if curr_node.left: stack.append(curr_node) stack.append(curr_node.left) curr_node.left = None elif curr_node.right: stack.append(curr_node) stack.append(curr_node.right) curr_node.right = None else: result.append(curr_node.val) return result ================================================ FILE: apps/website/experimental/utilities/python/trie.py ================================================ class Trie(object): def __init__(self): """ Initialize your data structure here. """ self.d = {} def insert(self, word): """ Inserts a word into the trie. :type word: str :rtype: void """ curr = self.d for char in word: if char not in curr: curr[char] = {} curr = curr[char] curr['#'] = {} # Using an empty dict rather than a boolean value makes recursive traversal easier. def search(self, word): """ Returns if the word is in the trie. :type word: str :rtype: bool """ curr = self.d for char in word: if char in curr: curr = curr[char] else: return False return '#' in curr def startsWith(self, prefix): """ Returns if there is any word in the trie that starts with the given prefix. :type prefix: str :rtype: bool """ curr = self.d for char in prefix: if char in curr: curr = curr[char] else: return False return True def searchRegex(self, word): """ Returns if the word is in the data structure. A word could contain the dot character '.' to represent any one letter. :type word: str :rtype: bool """ def traverse(node, index): if len(word) == index: return '#' in node char = word[index] if char == '.': for key in node.keys(): if traverse(node[key], index+1): return True return False else: if char not in node: return False return traverse(node[char], index + 1) return traverse(self.d, 0) # Example trie = Trie() trie.insert('hello') print(trie.search('hello') == True) print(trie.startsWith('hello') == True) print(trie.startsWith('hel') == True) print(trie.search('world') == False) print(trie.startsWith('wor') == False) print(trie.searchRegex('..llo') == True) print(trie.searchRegex('..llx') == False) print(trie.searchRegex('..') == False) ================================================ FILE: apps/website/experimental/utilities/python/union_find.py ================================================ ## Union-Find data structure ## https://en.wikipedia.org/wiki/Disjoint-set_data_structure parents = [0, 1, 2, 3, 4, 5, 6] # parent[i] is the parent of i weights = [1, 1, 1, 1, 1, 1, 1] def find_root(parents, p): '''Average: O(log n)''' root = p while parents[root] != root: root = parents[root] # Flatten tree while parents[p] != p: parents[p], p = root, parents[p] return root def union(parents, p, q): '''Average: O(log n)''' p = find_root(parents, p) q = find_root(parents, q) # Link the smaller node to the larger node if weights[p] > weights[q]: parents[q] = p weights[p] += weights[q] else: parents[p] = q weights[q] += weights[p] # Start with all elements separate # -> [0], [1], [2], [3], [4], [5], [6] print(find_root(parents, 2) == 2) # Merge 1, 2, 3 and 4, 5, 6 # -> [0], [1, 2, 3], [4, 5, 6] union(parents, 1, 2) union(parents, 2, 3) union(parents, 4, 5) union(parents, 4, 6) # Roots of 1, 2, 3 and 4, 5, 6 are the same print(find_root(parents, 0)) print(list(find_root(parents, i) for i in (1, 2, 3))) print(list(find_root(parents, i) for i in (4, 5, 6))) # Merge 2, 4 # -> [0], [1, 2, 3, 4, 5, 6] union(parents, 2, 4) print(list(find_root(parents, i) for i in (1, 2, 3, 4, 5, 6))) ================================================ FILE: apps/website/functions/grind75/[[catchall]].js ================================================ const SOURCE_HOST = 'https://grind75.pages.dev'; export async function onRequest(context) { const { request } = context; // Define the original and target paths const url = new URL(request.url); // Rewrite to the new domain, preserving the original path and query string const newURL = SOURCE_HOST + url.pathname + url.search; // Fetch the content from the new domain return await fetch(newURL, request); } ================================================ FILE: apps/website/package.json ================================================ { "name": "@tih/website", "version": "0.0.0", "private": true, "scripts": { "docusaurus": "docusaurus", "start": "docusaurus start", "dev": "docusaurus start", "build": "docusaurus build", "lint": "vp lint docusaurus.config.js sidebars.js src", "swizzle": "docusaurus swizzle", "deploy": "docusaurus deploy" }, "dependencies": { "@docusaurus/core": "^2.4.3", "@docusaurus/plugin-client-redirects": "^2.4.3", "@docusaurus/preset-classic": "^2.4.3", "@docusaurus/theme-common": "^2.4.3", "clsx": "^2", "react": "^18.2.0", "react-dom": "^18.2.0" }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] } } ================================================ FILE: apps/website/sidebars.js ================================================ module.exports = { docs: [ { type: 'category', label: 'Introduction', collapsible: false, items: ['software-engineering-interview-guide'], }, { type: 'category', label: 'Getting an interview', collapsible: false, items: ['resume'], }, { type: 'category', label: 'Coding interview preparation', collapsible: false, items: [ 'coding-interview-prep', 'programming-languages-for-coding-interviews', 'coding-interview-study-plan', 'coding-interview-cheatsheet', 'coding-interview-techniques', 'mock-interviews', 'coding-interview-rubrics', ], }, { type: 'category', label: 'System design interview preparation', collapsible: false, items: ['system-design'], }, { type: 'category', label: 'Behavioral interview preparation', collapsible: false, items: [ 'behavioral-interview', 'behavioral-interview-rubrics', 'behavioral-interview-questions', 'behavioral-interview-senior-candidates', 'self-introduction', 'final-questions', ], }, { 'Salary and offer negotiation preparation': [ 'understanding-compensation', 'negotiation', 'negotiation-rules', 'choosing-between-companies', ], }, { 'Algorithms study cheatsheets': [ 'algorithms/study-cheatsheet', { type: 'category', label: 'Basics', collapsible: false, items: [ 'algorithms/array', 'algorithms/string', 'algorithms/hash-table', 'algorithms/recursion', 'algorithms/sorting-searching', ], }, { type: 'category', label: 'Data structures', collapsible: false, items: [ 'algorithms/matrix', 'algorithms/linked-list', 'algorithms/queue', 'algorithms/stack', 'algorithms/interval', ], }, { type: 'category', label: 'Advanced data structures', collapsible: false, items: [ 'algorithms/tree', 'algorithms/graph', 'algorithms/heap', 'algorithms/trie', ], }, { type: 'category', label: 'Additional', collapsible: false, items: [ 'algorithms/dynamic-programming', 'algorithms/binary', 'algorithms/math', 'algorithms/geometry', ], }, ], }, { 'Beyond the interview': [ 'interview-formats-top-companies', 'landscape', 'engineering-levels', 'career-growth', 'interviewer-cheatsheet', 'best-coding-interview-courses', 'best-practice-questions', ], }, ], }; ================================================ FILE: apps/website/src/components/SidebarAd/index.js ================================================ import React, { useEffect, useState } from 'react'; import BrowserOnly from '@docusaurus/BrowserOnly'; import clsx from 'clsx'; import styles from './styles.module.css'; const AD_REFRESH_RATE = 20 * 1000; function FAANGTechLeads({ position }) { return ( { window.gtag('event', `faangtechleads.${position}.click`); }}>

Craft the perfect resume for FAANG Save time crafting your resume with{' '} FAANG-quality resume templates and examples which have helped many Software Engineers get interviews at top Bay Area companies!

); } function GreatFrontEnd({ position }) { return ( { window.gtag('event', `greatfrontend.${position}.click`); }}>

LeetCode for Front End Built by ex-FAANG Senior Engineers, GreatFrontEnd is the fastest way to prepare for a Front End interview.

); } function DesignGurusSystemDesign({ position }) { return ( { window.gtag('event', `designgurus.system_design.${position}.click`); }}>

Get the job at FAANG Grokking the System Design Interview is a highly recommended course to get better at system design interviews. Find out more!

); } function ByteByteGoSystemDesign({ position }) { return ( { window.gtag('event', `bytebytego.system_design.${position}.click`); }}>

Ace Your Next System Design Interview ByteByteGo's system design interview course is everything you need to take your system design skill to the next level.{' '} Find out more!

); } export default React.memo(function SidebarAd({ position }) { const [counter, setCounter] = useState(0); useEffect(() => { const timer = setTimeout(() => { setCounter((counter) => counter + 1); }, AD_REFRESH_RATE); return () => clearTimeout(timer); }, [counter]); // Because the SSR and client output can differ and hydration doesn't patch attribute differences, // we'll render this on the browser only. return ( {() => { const rand = Math.random(); const path = window.location.pathname; // Ugly hack to show conditional sidebar content. if ( (path.includes('software-engineering-interview-guide') || path.includes('coding-interview-prep')) && position === 'in_doc' ) { return ; } if (path.includes('resume')) { return ; } if (path.includes('system-design')) { return rand < 0.5 ? ( ) : ( ); } return rand < 0.5 ? ( ) : ( ); }} ); }); ================================================ FILE: apps/website/src/components/SidebarAd/styles.module.css ================================================ .container { background-repeat: no-repeat; background-size: contain; border-radius: var(--ifm-global-radius); color: #fff; display: block; opacity: 0.9; padding: 1rem; transition: opacity var(--ifm-transition-fast) var(--ifm-transition-timing-default); } .container:hover { color: #fff !important; opacity: 1; text-decoration: none; } .backgroundFTL { background-color: rgb(244, 63, 94); } .backgroundGreatFrontEnd { background-image: linear-gradient(270deg, #ec4899, #4f46e5); } .backgroundGrokkingCoding { background-color: #6fc8cc; color: #083436 !important; } .backgroundGrokkingCoding:hover { color: #083436 !important; } .backgroundGrokkingSystemDesign { background-color: #58527b; } .backgroundRora { background-color: #1574f9; } .backgroundAlgoMonster { background-image: linear-gradient(270deg, #3e1792, #6a45b9); } .backgroundInterviewingio { background-color: #ffd829; color: rgb(10, 10, 10) !important; } .backgroundInterviewingio:hover { color: rgb(10, 10, 10) !important; } .backgroundByteByteGo { background-color: #35cea0; color: rgb(10, 10, 10); } .backgroundByteByteGo:hover { color: rgb(10, 10, 10); } .tagline { font-size: 0.75rem; margin-bottom: 0; } .title { display: block; font-size: 0.8rem; margin-bottom: 0.1rem; } .logo { width: 96px; } ================================================ FILE: apps/website/src/css/custom.css ================================================ @font-face { font-family: 'Inter var'; font-weight: 100 900; font-display: swap; font-style: normal; font-named-instance: 'Regular'; src: url('./fonts/Inter-roman-latin.var.woff2') format('woff2'); } @font-face { font-family: 'Inter var'; font-weight: 100 900; font-display: swap; font-style: italic; font-named-instance: 'Italic'; src: url('./fonts/Inter-italic-latin.var.woff2') format('woff2'); } :root { --ifm-color-primary: #6565d5; --ifm-color-primary-dark: #5959d2; --ifm-color-primary-darker: #4c4cce; --ifm-color-primary-darkest: #4040cb; --ifm-color-primary-light: #7e7edc; --ifm-color-primary-lighter: #8a8adf; --ifm-color-primary-lightest: #afafe9; --ifm-font-family-base: 'Inter var', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; --ifm-font-size-base: 16px; --ifm-footer-padding-vertical: 3rem; } html[data-theme='dark'] { --ifm-color-primary: #7f7ff0; --ifm-color-primary-dark: rgb(114, 114, 216); --ifm-color-primary-darker: rgb(108, 108, 204); --ifm-color-primary-darkest: rgb(89, 89, 168); --ifm-color-primary-light: rgb(146, 146, 242); --ifm-color-primary-lighter: rgb(165, 165, 245); --ifm-color-primary-lightest: rgb(191, 191, 248); } .navbar__items { font-size: 0.9rem; } .footer__links { margin-bottom: 3rem; } .footer__copyright { text-align: start; } .markdown h1:first-child { --ifm-h1-font-size: 1.5em; } @media screen and (min-width: 768px) { .markdown h1:first-child { --ifm-h1-font-size: 2.25em; } } .markdown h2 { --ifm-h2-font-size: 1.375em; margin-top: 2em; margin-bottom: 0.5em; } @media screen and (min-width: 768px) { .markdown h2 { --ifm-h2-font-size: 1.5em; } } .markdown h3 { --ifm-h3-font-size: 1.25em; font-weight: 600; margin-top: 1.8em; margin-bottom: 0.5em; } .markdown h4 { font-size: 1.15em; font-weight: 600; margin-top: 1.6em; margin-bottom: 0.4em; } .markdown h5 { font-size: 1em; font-weight: 600; margin-top: 1.4em; margin-bottom: 0.3em; } .markdown blockquote { border-left-color: var(--ifm-color-emphasis-200); border-left-width: 0.5rem; color: var(--ifm-color-emphasis-600); } .markdown ul blockquote { font-size: 0.9em; margin-top: 0.5em; } @media screen and (max-width: 767px) { :root { --ifm-font-size-base: 16px; } } div[class^='announcementBar_'] { background-color: var(--ifm-color-primary); color: #fff; font-weight: bold; } .menu { font-size: 0.875rem; } .table-of-contents { font-size: 0.75rem; } @media screen and (min-width: 768px) { .theme-doc-markdown { font-size: 18px; } } .theme-doc-markdown details { --ifm-alert-background-color: transparent; border: 1px solid var(--ifm-color-emphasis-800); } .theme-doc-markdown details h2, .theme-doc-markdown details h3, .theme-doc-markdown details h4, .theme-doc-markdown details h5, .theme-doc-markdown details h6 { margin-bottom: 0 !important; } .navbar-icon { border-radius: 50%; display: flex; height: 32px; width: 32px; align-items: center; justify-content: center; margin-right: 12px; padding: 0; transition: background var(--ifm-transition-fast); } .navbar-icon:hover { background: var(--ifm-color-emphasis-200); color: inherit; } .theme-doc-markdown .theme-admonition { font-size: 16px; } .admonition-heading h5 { margin-top: 0; } .shoutout { background-color: var(--ifm-color-primary); border-radius: 0.5rem; color: #fff; display: block; font-size: 14px; padding: 0.75rem; } .shoutout:hover { text-decoration: none; color: #fff; } ================================================ FILE: apps/website/src/data/successStories.js ================================================ import React from 'react'; export default [ { name: 'Erin Teo', title: 'Front End Engineer, Facebook', thumbnail: 'https://avatars1.githubusercontent.com/u/5081708?s=460&v=4', quote: ( <> Preparing for my first rounds of tech interviews was really daunting - I wasn't sure what to expect and where to start. This handbook together with the{' '} Front End Interview Handbook {' '} was a great starting point for me. It clearly describes each part of the process and has tons of awesome tips and resources. With this handbook and lots of practice, I managed to get offers from Facebook, Dropbox and Amazon! ), }, { name: 'Siddhesh Karekar', title: 'Software Engineer, Google', thumbnail: 'https://avatars1.githubusercontent.com/u/18223888?s=460&v=4', quote: ( <> Most of us are familiar with having the prospect of having to grind tons of LeetCode problems before the interview, but I really wanted a sense of direction, an outline of sorts to prepare efficiently; I wanted to pick questions that covered all the important concepts one can be tested on. The Tech Interview Handbook provides just that; the Algorithms section was an absolutely invaluable resource and a great overall reference to brush up my fundamentals with the helpful hints and tips provided, and also solve some of the most popular questions categorized by type. I certainly have this handbook to thank for helping me land my dream job at Google! ), }, { name: 'Zhenghao He', title: 'Senior Software Engineer, Instacart', thumbnail: 'https://github.com/zhenghaohe.png', quote: ( <> Tech Interview Handbook was the best resource I used during my coding interview prep. Its structure and hand-picked questions and detailed explanations really set it apart from other resources out there. I helped me go into my interviews with confidence. I ended up landing offers at Meta, Amazon, Twitch, Microsoft, Coinbase, Splunk, etc. I highly recommend Tech Interview Handbook to anyone looking to secure an offer from big tech companies.

I've learnt a few things and blogged about them on{' '} https://www.zhenghao.io/ , check them out if you're interested! ), }, { name: 'Kevin Huang', title: 'Software Engineer, Uber', thumbnail: 'https://avatars1.githubusercontent.com/u/25380336?s=460&v=4', quote: ( <> The Tech Interview Handbook played a crucial role in the success of my previous job search. The contents are carefully curated and well organized. It served as an excellent roadmap for my interview prep.

In addition to the thorough Data Structures and Algorithms section, the handbook also provides a lot of resources on other aspects of the application process that helped me see the tech interviews in a more holistic way. My favorite non-technical part was "Questions To Ask"! I used quite a few insightful questions from there to challenge and impress my interviewers. The results were great!

With the help of Tech Interview Handbook, I was able to land offers from Google, Amazon, Uber and several other great companies. Really appreciate the contributors for putting out such quality content for the community. I'd wholeheartedly recommend this handbook to anyone! ), }, { name: 'Rahul Senguttuvan', title: 'Software Engineer Intern, Meta', thumbnail: 'https://avatars.githubusercontent.com/u/26223361?v=4', quote: ( <> I started my interview preparation sometime during September of 2021. I was introduced to the famous Blind 75 list while browsing through LeetCode forums. The author of Blind 75, Yangshun Tay, had mentioned The Tech Interview Handbook in one of the comments. I immediately checked out the website and was extremely impressed.

The most use- section for me was the Coding and Algorithms along with Company interview formats where I learnt the process beforehand. The questions covered in the list along with the resources helped me get a broad understanding of concepts like BFS, DFS and array operations which I struggled with earlier. This helped me get into Mathworks, Microsoft and Meta for my internships.

Moving forward, I will continue to use this resource along with Grind 75 (A list of coding questions created by the same author) for my full time job hunt! I'm also excited to try out the System Design material as well! ), }, { name: 'Zongran Mo', title: 'Software Engineer, Abnormal Security', thumbnail: 'https://avatars.githubusercontent.com/u/19870898?s=400&v=4', quote: ( <> I have not been preparing much for my interviews before my final year in university. As I set my sights on my full time job, I referred heavily to this handbook about things to prepare and look out for during my applicaion. It has helped me so much in many stages of my application. My personal favorite is the best algorithm practice questions, which is helpful in the future if I want to switch jobs.

With the help of this handbook, I successfully land offers from Facebook, Quora, Abnormal Security and a few more established companies. Highly recommend any tech job applicants to refer to this handbook. ), }, { name: 'Jeanne Toh', title: 'Software Engineer Intern, Meta, Google', thumbnail: 'https://avatars.githubusercontent.com/u/54509483?v=4', quote: ( <> I remember not knowing what to expect when preparing for my first ever tech interview. Tech Interview Handbook was a lifesaver. It covers all the most important steps in applying for a tech role -- from resume preparation to offer negotiation.

My favourite part is the{' '} Grind 75 Tool , which provides customisable coding interview study plans. This not only helped to sharpen my problem-solving skills, but also assured me that I covered sufficient breadth and depth.

Even now, after interviewing for a couple of years, I still go back to the Tech Interview Handbook for a quick refresher before an interview, and it continues to help me land great offers. This is an incredible resource, created by someone who really wishes the best for you, and I highly recommend it! ), }, ]; ================================================ FILE: apps/website/src/pages/advertise.md ================================================ --- title: Become an advertiser description: Advertise with us and leverage on our audience of 40,000 to 50,000 software engineers monthly keywords: [ advertisement, sponsorship, sponsor, advertise, software engineer website advertisement, software engineering interview website advertisement, software engineering interview website sponsorship, ] hide_table_of_contents: true ---
# Become an advertiser! Tech Interview Handbook has and always will be free for our readers. As such, sponsors and advertisers go a long way in keeping the website up and running. Our handbook has become one of the best resources for software engineering interview preparation, amassing over 10,000 monthly organic referrals from other software engineers on forums, Twitter, coding interview preparation sites, and even by [Ivy League universities such as Yale University](https://ocs.yale.edu/channels/the-technical-interview/). We boast over 200,000 monthly pageviews from 40,000 to 50,000 unique software engineers who are looking for a job and preparing for interviews. ## Sponsorship and advertisement terms We run week-long exclusive sponsorships and advertisements on a fixed price schedule. Sponsors can choose any or all of the following positions to advertise with us: - Top of every page - Homepage - Sidebar and menu of every page - Navigation menu - Bottom of every page If you are keen to become our sponsor and advertise with us, please email us at [contact{at}techinterviewhandbook.org](mailto:contact@techinterviewhandbook.org).
================================================ FILE: apps/website/src/pages/index.js ================================================ import React from 'react'; import clsx from 'clsx'; import Layout from '@theme/Layout'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import Link from '@docusaurus/Link'; import useBaseUrl from '@docusaurus/useBaseUrl'; import styles from './styles.module.css'; import successStories from '../data/successStories'; const BLIND_75_URL = 'https://www.teamblind.com/post/New-Year-Gift---Curated-List-of-Top-75-LeetCode-Questions-to-Save-Your-Time-OaM1orEU'; const FEATURES = [ { id: 'zero-to-hero', title: <>💯 Go From zero to hero, description: ( <> Go from zero to tech interview hero with this handbook. No prior interview experience needed. ), link: '/software-engineering-interview-guide/', }, { id: 'curated-practice', title: <>📝 Curated practice questions, description: ( <> No one has time to practice a few hundred questions. We created the{' '} Blind 75 List {' '} to tell you which the best questions are. ), link: '/coding-interview-study-plan/', }, { id: 'best-practices', title: <>📋 Interview best practices, description: ( <> Straight-to-the-point Do's and Don'ts during an interview. The battle is already half won. ), link: '/coding-interview-cheatsheet/', }, { id: 'algorithm-tips', title: <>💁‍♀️ Practical algorithm tips, description: ( <> Practical tips for every algorithm topic - common techniques and corner cases to look out for. ), link: '/algorithms/study-cheatsheet/', }, { id: 'behavioral', title: <>💬 Behavioral questions, description: ( <> Check out what behavioral questions companies commonly ask and you can prepare your answers ahead of time. ), link: '/behavioral-interview-questions/', }, { id: 'tested', title: <>🧪 Tested and proven, description: ( <> Countless engineers have gotten their dream jobs with the help of Tech Interview Handbook. ), }, ]; function Tweet({ url, handle, name, content, avatar, date }) { return (
{name}
{name}{' '} @{handle} ·{' '} {date}
{content}
); } function Home() { const { siteConfig = {} } = useDocusaurusContext(); return ( ); } function HeroSection() { const { siteConfig = {} } = useDocusaurusContext(); return (
{siteConfig.title}

{siteConfig.title}

{siteConfig.tagline}
Brought to you by the author of{' '} Blind 75

Start reading now  →

Or check out our{' '} Front End Interview Handbook