PageSourceSearch

https://www.techinterviewhandbook.org/assets/js/0e0a41dd.daaa4060.js

js techinterviewhandbook.org collected 2026-10-03 19:21:38 UTC 11,820 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunk_tih_website=globalThis.webpackChunk_tih_website||[]).push([[1934],{2403(e,t,r){r.d(t,{xA:()=>u,yg:()=>m});var n=r(1855);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach(function(t){o(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function s(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},u=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},g=n.forwardRef(function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),g=c(r),m=o,d=g["".concat(l,".").concat(m)]||g[m]||p[m]||i;return r?n.createElement(d,a(a({ref:t},u),{},{components:r})):n.createElement(d,a({ref:t},u))});function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,a=new Array(i);a[0]=g;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var c=2;c<i;c++)a[c]=r[c];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}g.displayName="MDXCreateElement"},3861(e,t,r){r.d(t,{Ay:()=>a});var n=r(9932),o=(r(1855),r(2403));const i={toc:[{value:"AlgoMonster",id:"algomonster",level:3},{value:"Grokking the Coding Interview: Patterns for Coding Questions",id:"grokking-the-coding-interview-patterns-for-coding-questions",level:3},{value:"Master the Coding Interview: Data Structures + Algorithms",id:"master-the-coding-interview-data-structures--algorithms",level:3}]};function a(e){let{components:t,...r}=e;return(0,o.yg)("wrapper",(0,n.A)({},i,r,{components:t,mdxType:"MDXLayout"}),(0,o.yg)("h3",{id:"algomonster"},(0,o.yg)("a",{parentName:"h3",href:"https://shareasale.com/r.cfm?b=1873647&u=3114753&m=114505&urllink=&afftrack="},"AlgoMonster")),(0,o.yg)("p",null,"AlgoMonster aims to help you ace the technical interview ",(0,o.yg)("strong",{parentName:"p"},"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 ",(0,o.yg)("strong",{parentName:"p"},"lifetime access"),". ",(0,o.yg)("a",{parentName:"p",href:"https://shareasale.com/r.cfm?b=1873647&u=3114753&m=114505&urllink=&afftrack="},(0,o.yg)("strong",{parentName:"a"},"Join today for a 70% discount \u2192"))),(0,o.yg)("h3",{id:"grokking-the-coding-interview-patterns-for-coding-questions"},(0,o.yg)("a",{parentName:"h3",href:"https://www.designgurus.io/course/grokking-the-coding-interview?aff=kJSIoU"},"Grokking the Coding Interview: Patterns for Coding Questions")),(0,o.yg)("p",null,"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. ",(0,o.yg)("strong",{parentName:"p"},"Learn and understand patterns, not memorize answers!")," ",(0,o.yg)("a",{parentName:"p",href:"https://www.designgurus.io/course/grokking-the-coding-interview?aff=kJSIoU"},(0,o.yg)("strong",{parentName:"a"},"Get lifetime access now \u2192"))),(0,o.yg)("h3",{id:"master-the-coding-interview-data-structures--algorithms"},(0,o.yg)("a",{parentName:"h3",href:"https://www.udemy.com/course/master-the-coding-interview-data-structures-algorithms/"},"Master the Coding Interview: Data Structures + Algorithms")),(0,o.yg)("p",null,"This Udemy bestseller is one of the highest-rated interview preparation course (4.6 stars, 21.5k ratings, 135k students) and packs ",(0,o.yg)("strong",{parentName:"p"},"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. ",(0,o.yg)("a",{parentName:"p",href:"https://www.udemy.com/course/master-the-coding-interview-data-structures-algorithms/"},(0,o.yg)("strong",{parentName:"a"},"Check it out \u2192"))))}a.isMDXComponent=!0},4749(e,t,r){r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>g,frontMatter:()=>a,metadata:()=>l,toc:()=>u});var n=r(9932),o=(r(1855),r(2403)),i=r(3861);const a={id:"geometry",title:"Geometry cheatsheet for coding interviews",description:"Geometry study guide for coding interviews, including practice questions, te
1chniques, 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},s=void 0,l={unversionedId:"algorithms/geometry",id:"algorithms/geometry",title:"Geometry cheatsheet for coding interviews",description:"Geometry study guide for coding interviews, including practice questions, techniques, time complexity, and recommended resources",source:"@site/contents/algorithms/geometry.md",sourceDirName:"algorithms",slug:"/algorithms/geometry",permalink:"/algorithms/geometry",draft:!1,tags:[],version:"current",lastUpdatedAt:1786104387,formattedLastUpdatedAt:"Aug 7, 2026",frontMatter:{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},sidebar:"docs",previous:{title:"Math",permalink:"/algorithms/math"},next:{title:"\ud83d\udcbc Company interview formats",permalink:"/interview-formats-top-companies"}},c={},u=[{value:"Introduction",id:"introduction",level:2},{value:"Corner cases",id:"corner-cases",level:2},{value:"Techniques",id:"techniques",level:2},{value:"Distance between two points",id:"distance-between-two-points",level:3},{value:"Overlapping circles",id:"overlapping-circles",level:3},{value:"Overlapping rectangles",id:"overlapping-rectangles",level:3},{value:"Sample questions",id:"sample-questions",level:2},{value:"Essential questions",id:"essential-questions",level:2},{value:"Recommended practice questions",id:"recommended-practice-questions",level:2},{value:"Recommended courses",id:"recommended-courses",level:2}],p={toc:u};function g(e){let{components:t,...r}=e;return(0,o.yg)("wrapper",(0,n.A)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.yg)("head",null,(0,o.yg)("meta",{property:"og:image",content:"https://www.techinterviewhandbook.org/social/algorithms/algorithms/algorithms-geometry.png"})),(0,o.yg)("h2",{id:"introduction"},"Introduction"),(0,o.yg)("p",null,"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."),(0,o.yg)("p",null,"In algorithm interviews, geometry is usually not 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."),(0,o.yg)("h2",{id:"corner-cases"},"Corner cases"),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},"Zero values. This always gets people.")),(0,o.yg)("h2",{id:"techniques"},"Techniques"),(0,o.yg)("h3",{id:"distance-between-two-points"},"Distance between two points"),(0,o.yg)("p",null,"When comparing the distance between two points, using dx",(0,o.yg)("sup",null,"2")," + dy",(0,o.yg)("sup",null,"2")," is sufficient. It is unnecessary to square root the value. Examples: ",(0,o.yg)("a",{parentName:"p",href:"https://leetcode.com/problems/k-closest-points-to-origin/"},"K Closest Points to Origin")),(0,o.yg)("h3",{id:"overlapping-circles"},"Overlapping circles"),(0,o.yg)("p",null,"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."),(0,o.yg)("h3",{id:"overlapping-rectangles"},"Overlapping rectangles"),(0,o.yg)("p",null,"Two rectangles overlap if the following is true:"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-py"},"overlap = rect_a.left < rect_b.right and \\\n  rect_a.right > rect_b.left and \\\n  rect_a.top > rect_b.bottom and \\\n  rect_a.bottom < rect_b.top\n")),(0,o.yg)("p",null,"Here's a ",(0,o.yg)("a",{parentName:"p",href:"https://silentmatt.com/rectangle-intersection/"},"nice visualization"),". Examples: ",(0,o.yg)("a",{parentName:"p",href:"https://leetcode.com/problems/rectangle-overlap/"},"Rectangle Overlap")),(0,o.yg)("h2",{id:"sample-questions"},"Sample questions"),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},"You have a plane with lots of rectangles on it, find out how many of them intersect."),(0,o.yg)("li",{parentName:"ul"},"Which data structure would you use to query the k-nearest points of a set on a 2D plane?"),(0,o.yg)("li",{parentName:"ul"},"Given many points, find k points that are closest to the origin."),(0,o.yg)("li",{parentName:"ul"},"How would you triangulate a polygon?")),(0,o.yg)("h2",{id:"essential-questions"},"Essential questions"),(0,o.yg)("p",null,(0,o.yg)("em",{parentName:"p"},"These are essential questions to practice if you're studying for this topic.")),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("a",{parentName:"li",href:"https://leetcode.com/problems/rectangle-overlap/"},"Rectangle Overlap"))),(0,o.yg)("h2",{id:"recommended-practice-questions"},"Recommended practice questions"),(0,o.yg)("p",null,(0,o.yg)("em",{parentName:"p"},"These are recommended questions to practice after you have studied for the topic and have practiced the essential questions.")),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("a",{parentName:"li",href:"https://leetcode.com/problems/k-closest-points-to-origin/"},"K Closest Points to Origin")),(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("a",{parentName:"li",href:"https://leetcode.com/problems/rectangle-area/"},"Rectangle Area"))),(0,o.yg)("h2",{id:"recommended-courses"},"Recommended courses"),(0,o.yg)(i.Ay,{mdxType:"AlgorithmCourses"}))}g.isMDXComponent=!0}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.