From 1494a501238c5f47f08a9c80b5f09ef205e8f277 Mon Sep 17 00:00:00 2001 From: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> Date: Wed, 24 Jul 2019 00:59:27 -0700 Subject: [PATCH] fix(guide): restructure curriculum guide articles (#36501) * fix: restructure certifications guide articles * fix: added 3 dashes line before prob expl * fix: added 3 dashes line before hints * fix: added 3 dashes line before solutions --- .../exercise-tracker/index.md | 2 +- .../file-metadata-microservice/index.md | 2 +- .../apis-and-microservices-projects/index.md | 2 +- .../index.md | 2 +- .../timestamp-microservice/index.md | 45 +- .../url-shortener-microservice/index.md | 17 +- .../index.md | 66 +- .../get-data-from-post-requests/index.md | 30 +- .../index.md | 12 +- .../index.md | 19 +- .../index.md | 16 +- .../basic-node-and-express/index.md | 2 +- .../meet-the-node-console/index.md | 11 +- .../serve-an-html-file/index.md | 14 +- .../serve-json-on-a-specific-route/index.md | 11 +- .../serve-static-assets/index.md | 6 +- .../start-a-working-express-server/index.md | 8 +- .../index.md | 10 +- .../use-the-.env-file/index.md | 20 +- .../apis-and-microservices/index.md | 2 +- .../index.md | 12 +- .../index.md | 10 +- .../index.md | 8 +- .../index.md | 17 +- .../index.md | 5 +- .../index.md | 18 +- .../managing-packages-with-npm/index.md | 2 +- .../index.md | 9 +- .../index.md | 11 +- .../index.md | 16 +- .../index.md | 2 +- .../index.md | 80 +- .../create-a-model/index.md | 29 +- .../index.md | 8 +- .../index.md | 14 +- .../index.md | 2 +- .../index.md | 2 +- .../mongodb-and-mongoose/index.md | 2 +- .../install-and-set-up-mongoose/index.md | 14 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 10 +- .../index.md | 4 +- .../index.md | 4 +- .../find-the-symmetric-difference/index.md | 174 ++- .../algorithms/implement-bubble-sort/index.md | 40 +- .../implement-insertion-sort/index.md | 23 +- .../algorithms/implement-merge-sort/index.md | 35 +- .../algorithms/implement-quick-sort/index.md | 35 +- .../implement-selection-sort/index.md | 21 +- .../coding-interview-prep/algorithms/index.md | 2 +- .../algorithms/inventory-update/index.md | 347 +++--- .../algorithms/no-repeats-please/index.md | 122 +- .../algorithms/pairwise/index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../data-structures/adjacency-list/index.md | 54 +- .../data-structures/adjacency-matrix/index.md | 2 +- .../breadth-first-search/index.md | 90 +- .../index.md | 2 +- .../create-a-circular-queue/index.md | 107 +- .../create-a-doubly-linked-list/index.md | 2 +- .../create-a-hash-table/index.md | 2 +- .../create-a-linked-list-class/index.md | 2 +- .../create-a-map-data-structure/index.md | 2 +- .../create-a-priority-queue-class/index.md | 15 +- .../create-a-queue-class/index.md | 111 +- .../create-a-set-class/index.md | 41 +- .../create-a-stack-class/index.md | 112 +- .../create-a-trie-search-tree/index.md | 2 +- .../create-an-es6-javascript-map/index.md | 2 +- .../create-and-add-to-sets-in-es6/index.md | 35 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../depth-first-search/index.md | 2 +- .../index.md | 143 +-- .../index.md | 2 +- .../index.md | 2 +- .../data-structures/incidence-matrix/index.md | 2 +- .../data-structures/index.md | 2 +- .../index.md | 2 +- .../invert-a-binary-tree/index.md | 33 +- .../learn-how-a-stack-works/index.md | 17 +- .../index.md | 2 +- .../index.md | 2 +- .../perform-a-union-on-two-sets/index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../remove-items-from-a-set-in-es6/index.md | 2 +- .../reverse-a-doubly-linked-list/index.md | 31 +- .../search-within-a-linked-list/index.md | 2 +- .../data-structures/typed-arrays/index.md | 16 +- .../use-.has-and-.size-on-an-es6-set/index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../work-with-nodes-in-a-linked-list/index.md | 2 +- .../coding-interview-prep/index.md | 2 +- .../project-euler/index.md | 2 +- .../problem-1-multiples-of-3-and-5/index.md | 21 +- .../problem-10-summation-of-primes/index.md | 14 +- .../problem-2-even-fibonacci-numbers/index.md | 56 +- .../problem-3-largest-prime-factor/index.md | 24 +- .../index.md | 45 +- .../problem-5-smallest-multiple/index.md | 30 +- .../problem-6-sum-square-difference/index.md | 15 +- .../problem-7-10001st-prime/index.md | 47 +- .../index.md | 1032 ++++++++++++++++- .../index.md | 29 +- .../rosetta-code/100-doors/index.md | 2 +- .../rosetta-code/24-game/index.md | 2 +- .../index.md | 2 +- .../rosetta-code/abc-problem/index.md | 2 +- .../index.md | 2 +- .../rosetta-code/accumulator-factory/index.md | 2 +- .../rosetta-code/ackermann-function/index.md | 2 +- .../rosetta-code/align-columns/index.md | 2 +- .../rosetta-code/amicable-pairs/index.md | 2 +- .../rosetta-code/averagesmode/index.md | 2 +- .../averagespythagorean-means/index.md | 2 +- .../averagesroot-mean-square/index.md | 2 +- .../rosetta-code/babbage-problem/index.md | 2 +- .../rosetta-code/balanced-brackets/index.md | 21 +- .../index.md | 2 +- .../closest-pair-problem/index.md | 2 +- .../rosetta-code/combinations/index.md | 2 +- .../rosetta-code/comma-quibbling/index.md | 2 +- .../compare-a-list-of-strings/index.md | 2 +- .../index.md | 2 +- .../count-occurrences-of-a-substring/index.md | 2 +- .../rosetta-code/count-the-coins/index.md | 2 +- .../rosetta-code/cramers-rule/index.md | 2 +- .../rosetta-code/date-format/index.md | 2 +- .../rosetta-code/date-manipulation/index.md | 2 +- .../rosetta-code/day-of-the-week/index.md | 2 +- .../deal-cards-for-freecell/index.md | 2 +- .../rosetta-code/deepcopy/index.md | 2 +- .../define-a-primitive-data-type/index.md | 2 +- .../rosetta-code/department-numbers/index.md | 2 +- .../rosetta-code/discordian-date/index.md | 2 +- .../element-wise-operations/index.md | 2 +- .../rosetta-code/emirp-primes/index.md | 2 +- .../rosetta-code/entropy/index.md | 2 +- .../rosetta-code/equilibrium-index/index.md | 2 +- .../ethiopian-multiplication/index.md | 2 +- .../rosetta-code/euler-method/index.md | 2 +- .../evaluate-binomial-coefficients/index.md | 2 +- .../execute-a-markov-algorithm/index.md | 2 +- .../rosetta-code/execute-brain/index.md | 2 +- .../extensible-prime-generator/index.md | 2 +- .../rosetta-code/factorial/index.md | 2 +- .../factors-of-a-mersenne-number/index.md | 2 +- .../factors-of-an-integer/index.md | 2 +- .../rosetta-code/farey-sequence/index.md | 2 +- .../index.md | 2 +- .../rosetta-code/fibonacci-sequence/index.md | 2 +- .../rosetta-code/fibonacci-word/index.md | 2 +- .../rosetta-code/fractran/index.md | 2 +- .../rosetta-code/gamma-function/index.md | 2 +- .../gaussian-elimination/index.md | 2 +- .../rosetta-code/general-fizzbuzz/index.md | 2 +- .../index.md | 2 +- .../generatorexponential/index.md | 2 +- .../rosetta-code/gray-code/index.md | 2 +- .../greatest-common-divisor/index.md | 2 +- .../greatest-subsequential-sum/index.md | 2 +- .../rosetta-code/hailstone-sequence/index.md | 2 +- .../rosetta-code/happy-numbers/index.md | 2 +- .../harshad-or-niven-series/index.md | 2 +- .../hash-from-two-arrays/index.md | 2 +- .../rosetta-code/hash-join/index.md | 2 +- .../rosetta-code/heronian-triangles/index.md | 2 +- .../index.md | 2 +- .../hofstadter-q-sequence/index.md | 2 +- .../i-before-e-except-after-c/index.md | 2 +- .../rosetta-code/iban/index.md | 2 +- .../rosetta-code/identity-matrix/index.md | 2 +- .../rosetta-code/index.md | 2 +- .../iterated-digits-squaring/index.md | 2 +- .../rosetta-code/jaro-distance/index.md | 2 +- .../rosetta-code/jortsort/index.md | 2 +- .../rosetta-code/josephus-problem/index.md | 2 +- .../rosetta-code/s-expressions/index.md | 2 +- .../index.md | 2 +- .../rosetta-code/sedols/index.md | 2 +- .../rosetta-code/taxicab-numbers/index.md | 2 +- .../tokenize-a-string-with-escaping/index.md | 2 +- .../rosetta-code/top-rank-per-group/index.md | 2 +- .../rosetta-code/topological-sort/index.md | 2 +- .../rosetta-code/towers-of-hanoi/index.md | 2 +- .../vector-cross-product/index.md | 2 +- .../rosetta-code/vector-dot-product/index.md | 2 +- .../rosetta-code/word-wrap/index.md | 2 +- .../rosetta-code/y-combinator/index.md | 2 +- .../zeckendorf-number-representation/index.md | 2 +- .../zhang-suen-thinning-algorithm/index.md | 2 +- .../rosetta-code/zig-zag-matrix/index.md | 2 +- .../build-a-camper-leaderboard/index.md | 2 +- .../build-a-light-bright-app/index.md | 2 +- .../index.md | 2 +- .../build-a-pinterest-clone/index.md | 2 +- .../build-a-pong-game/index.md | 2 +- .../build-a-recipe-box/index.md | 2 +- .../index.md | 2 +- .../build-a-simon-game/index.md | 2 +- .../build-a-tic-tac-toe-game/index.md | 2 +- .../build-a-voting-app/index.md | 2 +- .../build-a-wikipedia-viewer/index.md | 2 +- .../index.md | 2 +- .../build-the-game-of-life/index.md | 2 +- .../chart-the-stock-market/index.md | 2 +- .../take-home-projects/index.md | 2 +- .../manage-a-book-trading-club/index.md | 2 +- .../map-data-across-the-globe/index.md | 2 +- .../p2p-video-chat-application/index.md | 2 +- .../index.md | 2 +- .../show-the-local-weather/index.md | 2 +- .../use-the-twitch-json-api/index.md | 5 + .../data-visualization-projects/index.md | 2 +- .../visualize-data-with-a-bar-chart/index.md | 5 +- .../index.md | 2 +- .../visualize-data-with-a-heat-map/index.md | 2 +- .../index.md | 6 +- .../index.md | 2 +- .../index.md | 14 +- .../add-a-tooltip-to-a-d3-element/index.md | 13 +- .../index.md | 2 +- .../add-axes-to-a-visualization/index.md | 15 +- .../add-classes-with-d3/index.md | 2 +- .../add-document-elements-with-d3/index.md | 32 +- .../add-inline-styling-to-elements/index.md | 31 +- .../add-labels-to-d3-elements/index.md | 2 +- .../index.md | 16 +- .../change-styles-based-on-data/index.md | 25 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 21 +- .../create-a-linear-scale-with-d3/index.md | 17 +- .../index.md | 16 +- .../display-shapes-with-svg/index.md | 22 +- .../index.md | 2 +- .../index.md | 2 +- .../data-visualization-with-d3/index.md | 2 +- .../invert-svg-elements/index.md | 2 +- .../learn-about-svg-in-d3/index.md | 17 +- .../index.md | 15 +- .../index.md | 17 +- .../style-d3-labels/index.md | 14 +- .../index.md | 2 +- .../index.md | 14 +- .../use-dynamic-scales/index.md | 13 +- .../index.md | 16 +- .../work-with-data-in-d3/index.md | 34 +- .../work-with-dynamic-data-in-d3/index.md | 44 +- .../data-visualization/index.md | 2 +- .../access-the-json-data-from-an-api/index.md | 2 +- .../change-text-with-click-events/index.md | 2 +- .../convert-json-data-to-html/index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../json-apis-and-ajax/index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../render-images-from-data-sources/index.md | 2 +- .../index.md | 36 +- .../index.md | 33 +- .../index.md | 15 +- .../index.md | 15 +- .../index.md | 17 +- .../index.md | 16 +- .../center-text-with-bootstrap/index.md | 15 +- .../index.md | 2 +- .../create-a-bootstrap-button/index.md | 2 +- .../create-a-bootstrap-headline/index.md | 2 +- .../bootstrap/create-a-bootstrap-row/index.md | 2 +- .../index.md | 15 +- .../create-a-custom-heading/index.md | 2 +- .../bootstrap/create-bootstrap-wells/index.md | 2 +- .../ditch-custom-css-for-bootstrap/index.md | 18 +- .../give-each-element-a-unique-id/index.md | 2 +- .../index.md | 2 +- .../front-end-libraries/bootstrap/index.md | 4 +- .../label-bootstrap-buttons/index.md | 2 +- .../bootstrap/label-bootstrap-wells/index.md | 2 +- .../index.md | 2 +- .../make-images-mobile-responsive/index.md | 2 +- .../responsively-style-checkboxes/index.md | 2 +- .../responsively-style-radio-buttons/index.md | 2 +- .../split-your-bootstrap-row/index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../use-comments-to-clarify-code/index.md | 2 +- .../index.md | 19 +- .../index.md | 2 +- .../index.md | 2 +- .../build-a-drum-machine/index.md | 2 +- .../build-a-javascript-calculator/index.md | 2 +- .../build-a-markdown-previewer/index.md | 2 +- .../build-a-pomodoro-clock/index.md | 2 +- .../build-a-random-quote-machine/index.md | 4 +- .../front-end-libraries-projects/index.md | 4 +- .../front-end-libraries/index.md | 4 +- .../index.md | 11 +- .../index.md | 12 +- .../clone-an-element-using-jquery/index.md | 19 +- .../delete-your-jquery-functions/index.md | 2 +- .../disable-an-element-using-jquery/index.md | 2 +- .../front-end-libraries/jquery/index.md | 4 +- .../index.md | 2 +- .../remove-an-element-using-jquery/index.md | 2 +- .../index.md | 10 +- .../index.md | 2 +- .../index.md | 13 +- .../index.md | 14 +- .../index.md | 2 +- .../index.md | 23 +- .../index.md | 2 +- .../index.md | 11 +- .../index.md | 11 +- .../index.md | 2 +- .../index.md | 16 +- .../connect-redux-to-react/index.md | 13 +- .../index.md | 11 +- .../extract-local-state-into-redux/index.md | 19 +- .../extract-state-logic-to-redux/index.md | 27 +- .../getting-started-with-react-redux/index.md | 14 +- .../react-and-redux/index.md | 4 +- .../manage-state-locally-first/index.md | 15 +- .../map-dispatch-to-props/index.md | 10 +- .../map-state-to-props/index.md | 13 +- .../moving-forward-from-here/index.md | 11 +- .../index.md | 21 +- .../access-props-using-this.props/index.md | 11 +- .../react/add-comments-in-jsx/index.md | 7 +- .../react/add-event-listeners/index.md | 23 +- .../react/add-inline-styles-in-react/index.md | 15 +- .../bind-this-to-a-class-method/index.md | 16 +- .../index.md | 64 +- .../react/compose-react-components/index.md | 16 +- .../create-a-complex-jsx-element/index.md | 19 +- .../index.md | 21 +- .../react/create-a-controlled-form/index.md | 11 +- .../react/create-a-controlled-input/index.md | 16 +- .../react/create-a-react-component/index.md | 18 +- .../create-a-simple-jsx-element/index.md | 19 +- .../create-a-stateful-component/index.md | 16 +- .../index.md | 21 +- .../define-an-html-class-in-jsx/index.md | 20 +- .../index.md | 18 +- .../front-end-libraries/react/index.md | 4 +- .../react/introducing-inline-styles/index.md | 13 +- .../index.md | 23 +- .../index.md | 40 +- .../index.md | 15 +- .../react/override-default-props/index.md | 19 +- .../react/pass-a-callback-as-props/index.md | 51 +- .../react/pass-an-array-as-props/index.md | 28 +- .../index.md | 17 +- .../index.md | 40 +- .../index.md | 50 +- .../render-conditionally-from-props/index.md | 12 +- .../render-html-elements-to-the-dom/index.md | 23 +- .../index.md | 11 +- .../index.md | 17 +- .../index.md | 15 +- .../render-with-an-ifelse-condition/index.md | 13 +- .../index.md | 32 +- .../set-state-with-this.setstate/index.md | 21 +- .../index.md | 30 +- .../index.md | 18 +- .../index.md | 13 +- .../index.md | 19 +- .../index.md | 20 +- .../react/use-default-props/index.md | 12 +- .../index.md | 11 +- .../index.md | 16 +- .../use-state-to-toggle-an-element/index.md | 24 +- .../index.md | 25 +- .../index.md | 21 +- .../index.md | 14 +- .../react/write-a-simple-counter/index.md | 17 +- .../redux/combine-multiple-reducers/index.md | 23 +- .../index.md | 37 +- .../redux/create-a-redux-store/index.md | 8 +- .../redux/define-a-redux-action/index.md | 8 +- .../redux/define-an-action-creator/index.md | 29 +- .../redux/dispatch-an-action-event/index.md | 12 +- .../get-state-from-the-redux-store/index.md | 13 +- .../handle-an-action-in-the-store/index.md | 28 +- .../front-end-libraries/redux/index.md | 4 +- .../redux/never-mutate-state/index.md | 46 +- .../redux/register-a-store-listener/index.md | 25 +- .../remove-an-item-from-an-array/index.md | 33 +- .../send-action-data-to-the-store/index.md | 31 +- .../index.md | 40 +- .../redux/use-const-for-action-types/index.md | 50 +- .../index.md | 42 +- .../index.md | 23 +- .../redux/write-a-counter-with-redux/index.md | 63 +- .../index.md | 44 +- .../create-reusable-css-with-mixins/index.md | 15 +- .../index.md | 17 +- .../front-end-libraries/sass/index.md | 4 +- .../sass/nest-css-with-sass/index.md | 26 +- .../index.md | 16 +- .../store-data-with-sass-variables/index.md | 15 +- .../index.md | 17 +- .../use-for-to-create-a-sass-loop/index.md | 15 +- .../index.md | 12 +- guide/english/certifications/index.md | 2 +- .../announce-new-users/index.md | 2 +- .../authentication-strategies/index.md | 2 +- .../authentication-with-socket.io/index.md | 2 +- .../index.md | 2 +- .../communicate-by-emitting/index.md | 2 +- .../create-new-middleware/index.md | 2 +- .../handle-a-disconnect/index.md | 2 +- .../hashing-your-passwords/index.md | 2 +- .../how-to-put-a-profile-together/index.md | 2 +- .../how-to-use-passport-strategies/index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../advanced-node-and-express/index.md | 4 +- .../logging-a-user-out/index.md | 2 +- .../registration-of-new-users/index.md | 17 +- .../send-and-display-chat-messages/index.md | 2 +- .../serialization-of-a-user-object/index.md | 2 +- .../set-up-a-template-engine/index.md | 2 +- .../set-up-passport/index.md | 2 +- .../set-up-the-environment/index.md | 2 +- .../use-a-template-engines-powers/index.md | 2 +- .../index.md | 4 +- .../anonymous-message-board/index.md | 2 +- .../index.md | 4 +- .../issue-tracker/index.md | 2 +- .../metric-imperial-converter/index.md | 2 +- .../personal-library/index.md | 2 +- .../stock-price-checker/index.md | 2 +- .../index.md | 20 +- .../index.md | 16 +- .../index.md | 7 +- .../index.md | 17 +- .../index.md | 19 +- .../index.md | 29 +- .../index.md | 25 +- .../index.md | 19 +- .../index.md | 4 +- .../install-and-require-helmet/index.md | 24 +- .../index.md | 22 +- .../index.md | 19 +- .../index.md | 19 +- .../index.md | 23 +- .../understand-bcrypt-hashes/index.md | 22 +- .../index.md | 34 +- .../index.md | 24 +- .../index.md | 4 +- .../index.md | 24 +- .../index.md | 64 +- .../index.md | 55 +- .../index.md | 50 +- .../index.md | 48 +- .../index.md | 56 +- .../index.md | 59 +- .../test-for-truthiness/index.md | 31 +- .../index.md | 23 +- .../index.md | 26 +- .../test-if-a-value-is-a-string/index.md | 23 +- .../test-if-a-value-is-an-array/index.md | 26 +- .../index.md | 23 +- .../index.md | 28 +- .../index.md | 23 +- .../test-if-an-object-has-a-property/index.md | 23 +- .../index.md | 26 +- .../index.md | 28 +- .../index.md | 28 +- .../index.md | 25 +- .../index.md | 30 +- .../index.md | 30 +- .../boo-who/index.md | 52 +- .../chunky-monkey/index.md | 174 +-- .../confirm-the-ending/index.md | 30 +- .../convert-celsius-to-fahrenheit/index.md | 57 +- .../factorialize-a-number/index.md | 84 +- .../falsy-bouncer/index.md | 72 +- .../index.md | 105 +- .../finders-keepers/index.md | 57 +- .../basic-algorithm-scripting/index.md | 4 +- .../mutations/index.md | 81 +- .../repeat-a-string-repeat-a-string/index.md | 100 +- .../return-largest-numbers-in-arrays/index.md | 107 +- .../reverse-a-string/index.md | 62 +- .../slice-and-splice/index.md | 39 +- .../title-case-a-sentence/index.md | 102 +- .../truncate-a-string/index.md | 65 +- .../where-do-i-belong/index.md | 190 +-- .../index.md | 14 +- .../index.md | 18 +- .../index.md | 21 +- .../add-items-using-splice/index.md | 32 +- .../index.md | 22 +- .../index.md | 44 +- .../index.md | 31 +- .../index.md | 14 +- .../index.md | 17 +- .../copy-array-items-using-slice/index.md | 22 +- .../index.md | 30 +- .../index.md | 14 +- .../basic-data-structures/index.md | 4 +- .../index.md | 42 +- .../index.md | 33 +- .../index.md | 38 +- .../index.md | 28 +- .../index.md | 14 +- .../remove-items-using-splice/index.md | 14 +- .../index.md | 32 +- .../index.md | 13 +- .../access-array-data-with-indexes/index.md | 14 +- .../index.md | 8 +- .../accessing-nested-arrays/index.md | 62 +- .../accessing-nested-objects/index.md | 24 +- .../index.md | 13 +- .../index.md | 20 +- .../index.md | 13 +- .../index.md | 26 +- .../add-two-numbers-with-javascript/index.md | 17 +- .../index.md | 43 +- .../appending-variables-to-strings/index.md | 17 +- .../assignment-with-a-returned-value/index.md | 15 +- .../build-javascript-objects/index.md | 22 +- .../chaining-if-else-statements/index.md | 51 +- .../comment-your-javascript-code/index.md | 19 +- .../index.md | 33 +- .../index.md | 33 +- .../index.md | 19 +- .../index.md | 29 +- .../index.md | 24 +- .../index.md | 24 +- .../index.md | 36 +- .../index.md | 26 +- .../index.md | 32 +- .../index.md | 19 +- .../index.md | 16 +- .../index.md | 15 +- .../index.md | 15 +- .../index.md | 14 +- .../index.md | 14 +- .../index.md | 16 +- .../index.md | 19 +- .../count-backwards-with-a-for-loop/index.md | 35 +- .../basic-javascript/counting-cards/index.md | 113 +- .../index.md | 16 +- .../declare-javascript-variables/index.md | 24 +- .../declare-string-variables/index.md | 16 +- .../index.md | 16 +- .../index.md | 32 +- .../index.md | 17 +- .../index.md | 13 +- .../escape-sequences-in-strings/index.md | 20 +- .../index.md | 19 +- .../find-the-length-of-a-string/index.md | 18 +- .../index.md | 10 +- .../index.md | 44 +- .../index.md | 41 +- .../index.md | 22 +- .../global-scope-and-functions/index.md | 16 +- .../index.md | 17 +- .../basic-javascript/golf-code/index.md | 171 +-- .../index.md | 16 +- .../basic-javascript/index.md | 4 +- .../index.md | 12 +- .../introducing-else-if-statements/index.md | 68 +- .../introducing-else-statements/index.md | 35 +- .../index.md | 62 +- .../index.md | 36 +- .../index.md | 17 +- .../index.md | 3 +- .../index.md | 33 +- .../local-scope-and-functions/index.md | 16 +- .../index.md | 3 +- .../manipulate-arrays-with-pop/index.md | 23 +- .../manipulate-arrays-with-push/index.md | 8 +- .../manipulate-arrays-with-shift/index.md | 8 +- .../manipulate-arrays-with-unshift/index.md | 8 +- .../manipulating-complex-objects/index.md | 65 +- .../modify-array-data-with-indexes/index.md | 12 +- .../index.md | 65 +- .../index.md | 15 +- .../index.md | 10 +- .../index.md | 8 +- .../nesting-for-loops/index.md | 69 +- .../index.md | 8 +- .../index.md | 33 +- .../basic-javascript/profile-lookup/index.md | 73 +- .../index.md | 3 +- .../record-collection/index.md | 61 +- .../replace-loops-using-recursion/index.md | 2 +- .../index.md | 128 +- .../index.md | 14 +- .../index.md | 45 +- .../index.md | 37 +- .../index.md | 73 +- .../basic-javascript/shopping-list/index.md | 84 +- .../basic-javascript/stand-in-line/index.md | 57 +- .../index.md | 13 +- .../index.md | 20 +- .../index.md | 14 +- .../testing-objects-for-properties/index.md | 38 +- .../understand-string-immutability/index.md | 24 +- .../understanding-boolean-values/index.md | 30 +- .../index.md | 15 +- .../index.md | 8 +- .../index.md | 7 +- .../updating-object-properties/index.md | 26 +- .../index.md | 16 +- .../index.md | 16 +- .../index.md | 8 +- .../index.md | 14 +- .../index.md | 42 +- .../index.md | 20 +- .../index.md | 24 +- .../index.md | 27 +- .../use-the-parseint-function/index.md | 22 +- .../using-objects-for-lookups/index.md | 61 +- .../basic-javascript/word-blanks/index.md | 71 +- .../index.md | 17 +- .../index.md | 21 +- .../index.md | 24 +- .../index.md | 16 +- .../index.md | 23 +- .../index.md | 53 +- .../index.md | 12 +- .../index.md | 23 +- .../debugging/index.md | 4 +- .../index.md | 13 +- .../index.md | 17 +- .../index.md | 28 +- .../index.md | 10 +- .../index.md | 18 +- .../index.md | 55 +- .../index.md | 21 +- .../index.md | 41 +- .../index.md | 52 +- .../index.md | 41 +- .../es6/import-a-default-export/index.md | 18 +- .../es6/index.md | 4 +- .../index.md | 49 +- .../es6/prevent-object-mutation/index.md | 61 +- .../index.md | 40 +- .../index.md | 20 +- .../index.md | 20 +- .../index.md | 20 +- .../index.md | 33 +- .../index.md | 21 +- .../index.md | 19 +- .../index.md | 18 +- .../index.md | 32 +- .../index.md | 47 +- .../use-export-to-reuse-a-code-block/index.md | 18 +- .../index.md | 32 +- .../index.md | 37 +- .../index.md | 39 +- .../index.md | 22 +- .../index.md | 19 +- .../index.md | 19 +- .../index.md | 21 +- .../index.md | 32 +- .../index.md | 22 +- .../index.md | 21 +- .../index.md | 23 +- .../implement-map-on-a-prototype/index.md | 43 +- .../index.md | 29 +- .../functional-programming/index.md | 4 +- .../index.md | 15 +- .../index.md | 23 +- .../index.md | 22 +- .../index.md | 45 +- .../index.md | 20 +- .../index.md | 16 +- .../index.md | 27 +- .../index.md | 22 +- .../index.md | 15 +- .../index.md | 48 +- .../index.md | 60 +- .../index.md | 47 +- .../index.md | 39 +- .../index.md | 55 +- .../index.md | 23 +- .../index.md | 263 +++-- .../index.md | 17 +- .../index.md | 4 +- .../arguments-optional/index.md | 163 ++- .../binary-agents/index.md | 164 +-- .../convert-html-entities/index.md | 98 +- .../diff-two-arrays/index.md | 121 +- .../dna-pairing/index.md | 131 +-- .../drop-it/index.md | 129 ++- .../everything-be-true/index.md | 137 ++- .../intermediate-algorithm-scripting/index.md | 4 +- .../make-a-person/index.md | 44 +- .../map-the-debris/index.md | 182 +-- .../missing-letters/index.md | 152 +-- .../pig-latin/index.md | 152 +-- .../search-and-replace/index.md | 296 ++--- .../seek-and-destroy/index.md | 88 +- .../smallest-common-multiple/index.md | 246 ++-- .../sorted-union/index.md | 209 ++-- .../spinal-tap-case/index.md | 128 +- .../steamroller/index.md | 171 +-- .../sum-all-numbers-in-a-range/index.md | 123 +- .../sum-all-odd-fibonacci-numbers/index.md | 129 +-- .../sum-all-primes/index.md | 278 ++--- .../wherefore-art-thou/index.md | 170 +-- .../caesars-cipher/index.md | 111 +- .../cash-register/index.md | 179 +-- .../index.md | 4 +- .../palindrome-checker/index.md | 133 ++- .../roman-numeral-converter/index.md | 264 +++-- .../telephone-number-validator/index.md | 111 +- .../add-methods-after-inheritance/index.md | 28 +- .../index.md | 96 +- .../create-a-basic-javascript-object/index.md | 15 +- .../create-a-method-on-an-object/index.md | 22 +- .../define-a-constructor-function/index.md | 18 +- .../index.md | 17 +- .../object-oriented-programming/index.md | 4 +- .../index.md | 23 +- .../iterate-over-all-properties/index.md | 26 +- .../index.md | 19 +- .../override-inherited-methods/index.md | 13 +- .../index.md | 27 +- .../index.md | 24 +- .../index.md | 22 +- .../understand-own-properties/index.md | 19 +- .../index.md | 19 +- .../index.md | 15 +- .../understand-the-prototype-chain/index.md | 17 +- .../index.md | 15 +- .../index.md | 15 +- .../index.md | 21 +- .../use-an-iife-to-create-a-module/index.md | 28 +- .../index.md | 22 +- .../index.md | 24 +- .../index.md | 23 +- .../index.md | 19 +- .../index.md | 19 +- .../check-for-all-or-none/index.md | 21 +- .../index.md | 6 +- .../extract-matches/index.md | 25 +- .../index.md | 13 +- .../find-more-than-the-first-match/index.md | 26 +- .../index.md | 24 +- .../ignore-case-while-matching/index.md | 20 +- .../regular-expressions/index.md | 4 +- .../index.md | 19 +- .../match-all-letters-and-numbers/index.md | 17 +- .../match-all-non-numbers/index.md | 19 +- .../match-all-numbers/index.md | 22 +- .../index.md | 22 +- .../match-beginning-string-patterns/index.md | 25 +- .../index.md | 17 +- .../index.md | 15 +- .../match-ending-string-patterns/index.md | 12 +- .../index.md | 13 +- .../match-letters-of-the-alphabet/index.md | 23 +- .../match-literal-strings/index.md | 20 +- .../match-non-whitespace-characters/index.md | 24 +- .../index.md | 37 +- .../index.md | 26 +- .../index.md | 26 +- .../match-whitespace/index.md | 15 +- .../positive-and-negative-lookahead/index.md | 19 +- .../index.md | 23 +- .../restrict-possible-usernames/index.md | 12 +- .../index.md | 28 +- .../specify-exact-number-of-matches/index.md | 27 +- .../index.md | 11 +- .../index.md | 24 +- .../index.md | 18 +- .../using-the-test-method/index.md | 18 +- .../index.md | 10 +- .../add-an-accessible-date-picker/index.md | 2 +- .../index.md | 10 +- .../index.md | 9 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../applied-accessibility/index.md | 4 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 9 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 13 +- .../index.md | 10 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 4 +- .../index.md | 2 +- .../index.md | 17 +- .../index.md | 2 +- .../index.md | 4 +- .../adjust-the-hue-of-a-color/index.md | 2 +- .../index.md | 2 +- .../adjust-the-tone-of-a-color/index.md | 9 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 9 +- .../index.md | 32 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 13 +- .../create-a-graphic-using-css/index.md | 2 +- .../index.md | 10 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 19 +- .../index.md | 10 +- .../index.md | 2 +- .../applied-visual-design/index.md | 4 +- .../learn-about-complementary-colors/index.md | 10 +- .../learn-about-tertiary-colors/index.md | 10 +- .../learn-how-bezier-curves-work/index.md | 2 +- .../index.md | 2 +- .../index.md | 22 +- .../index.md | 23 +- .../index.md | 2 +- .../index.md | 2 +- .../modify-fill-mode-of-an-animation/index.md | 10 +- .../index.md | 23 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 12 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 10 +- .../index.md | 10 +- .../index.md | 10 +- .../index.md | 2 +- .../use-the-em-tag-to-italicize-text/index.md | 2 +- .../index.md | 18 +- .../index.md | 2 +- .../index.md | 2 +- .../use-the-u-tag-to-underline-text/index.md | 2 +- .../index.md | 4 +- .../add-borders-around-your-elements/index.md | 14 +- .../index.md | 4 +- .../index.md | 6 +- .../index.md | 4 +- .../adjust-the-margin-of-an-element/index.md | 4 +- .../adjust-the-padding-of-an-element/index.md | 4 +- .../index.md | 13 +- .../cascading-css-variables/index.md | 16 +- .../index.md | 16 +- .../change-the-color-of-text/index.md | 18 +- .../index.md | 15 +- .../create-a-custom-css-variable/index.md | 14 +- .../index.md | 4 +- .../basic-css/import-a-google-font/index.md | 15 +- .../index.md | 14 +- .../responsive-web-design/basic-css/index.md | 4 +- .../index.md | 21 +- .../index.md | 13 +- .../index.md | 8 +- .../index.md | 4 +- .../index.md | 18 +- .../index.md | 4 +- .../index.md | 24 +- .../index.md | 4 +- .../set-the-id-of-an-element/index.md | 2 +- .../basic-css/size-your-images/index.md | 13 +- .../specify-how-fonts-should-degrade/index.md | 13 +- .../index.md | 15 +- .../style-the-html-body-element/index.md | 2 +- .../index.md | 2 +- .../index.md | 5 +- .../use-a-custom-css-variable/index.md | 2 +- .../index.md | 2 +- .../use-abbreviated-hex-code/index.md | 2 +- .../index.md | 2 +- .../index.md | 19 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 4 +- .../index.md | 2 +- .../use-hex-code-for-specific-colors/index.md | 2 +- .../use-hex-code-to-mix-colors/index.md | 25 +- .../basic-css/use-rgb-to-mix-colors/index.md | 49 +- .../use-rgb-values-to-color-elements/index.md | 2 +- .../add-a-submit-button-to-a-form/index.md | 4 +- .../add-images-to-your-website/index.md | 9 +- .../index.md | 4 +- .../index.md | 4 +- .../comment-out-html/index.md | 4 +- .../create-a-bulleted-unordered-list/index.md | 23 +- .../create-a-form-element/index.md | 4 + .../create-a-set-of-checkboxes/index.md | 4 +- .../create-a-set-of-radio-buttons/index.md | 2 +- .../create-a-text-field/index.md | 4 +- .../create-an-ordered-list/index.md | 4 +- .../index.md | 4 +- .../index.md | 4 +- .../delete-html-elements/index.md | 5 +- .../index.md | 4 +- .../headline-with-the-h2-element/index.md | 4 +- .../basic-html-and-html5/index.md | 4 +- .../index.md | 4 + .../introduction-to-html5-elements/index.md | 23 +- .../index.md | 6 +- .../index.md | 4 +- .../index.md | 4 +- .../index.md | 4 +- .../index.md | 4 +- .../say-hello-to-html-elements/index.md | 4 +- .../turn-an-image-into-a-link/index.md | 4 +- .../uncomment-html/index.md | 6 +- .../use-html5-to-require-a-field/index.md | 4 +- .../index.md | 5 +- .../index.md | 12 +- .../index.md | 4 +- .../index.md | 4 +- .../index.md | 11 +- .../index.md | 4 +- .../css-flexbox/index.md | 2 +- .../index.md | 12 +- .../index.md | 4 +- .../use-the-align-self-property/index.md | 4 +- .../index.md | 9 +- .../index.md | 9 +- .../index.md | 9 +- .../index.md | 4 +- .../use-the-flex-shorthand-property/index.md | 4 +- .../index.md | 4 +- .../index.md | 4 +- .../index.md | 4 +- .../index.md | 35 +- .../index.md | 26 +- .../add-gaps-faster-with-grid-gap/index.md | 26 +- .../add-rows-with-grid-template-rows/index.md | 22 +- .../index.md | 25 +- .../index.md | 24 +- .../index.md | 26 +- .../index.md | 25 +- .../index.md | 26 +- .../index.md | 22 +- .../index.md | 18 +- .../index.md | 2 +- .../create-grids-within-grids/index.md | 12 +- .../create-your-first-css-grid/index.md | 22 +- .../index.md | 22 +- .../responsive-web-design/css-grid/index.md | 4 +- .../index.md | 14 +- .../index.md | 15 +- .../index.md | 2 +- .../index.md | 23 +- .../index.md | 16 +- .../index.md | 2 +- .../use-grid-row-to-control-spacing/index.md | 2 +- .../index.md | 2 +- .../responsive-web-design/index.md | 4 +- .../create-a-media-query/index.md | 10 +- .../responsive-web-design-principles/index.md | 4 +- .../make-an-image-responsive/index.md | 10 +- .../make-typography-responsive/index.md | 20 +- .../index.md | 10 +- .../index.md | 2 +- .../build-a-product-landing-page/index.md | 2 +- .../build-a-survey-form/index.md | 2 +- .../index.md | 2 +- .../build-a-tribute-page/index.md | 2 +- .../responsive-web-design-projects/index.md | 4 +- 990 files changed, 13202 insertions(+), 8628 deletions(-) diff --git a/guide/english/certifications/apis-and-microservices/apis-and-microservices-projects/exercise-tracker/index.md b/guide/english/certifications/apis-and-microservices/apis-and-microservices-projects/exercise-tracker/index.md index 61bd899cb8..655197e79a 100644 --- a/guide/english/certifications/apis-and-microservices/apis-and-microservices-projects/exercise-tracker/index.md +++ b/guide/english/certifications/apis-and-microservices/apis-and-microservices-projects/exercise-tracker/index.md @@ -1,7 +1,7 @@ --- title: Exercise Tracker --- -## Exercise Tracker +# Exercise Tracker This is a stub. Help our community expand it. diff --git a/guide/english/certifications/apis-and-microservices/apis-and-microservices-projects/file-metadata-microservice/index.md b/guide/english/certifications/apis-and-microservices/apis-and-microservices-projects/file-metadata-microservice/index.md index f2ed98c632..2950f1a2a6 100644 --- a/guide/english/certifications/apis-and-microservices/apis-and-microservices-projects/file-metadata-microservice/index.md +++ b/guide/english/certifications/apis-and-microservices/apis-and-microservices-projects/file-metadata-microservice/index.md @@ -1,7 +1,7 @@ --- title: File Metadata Microservice --- -## File Metadata Microservice +# File Metadata Microservice This is a stub. Help our community expand it. diff --git a/guide/english/certifications/apis-and-microservices/apis-and-microservices-projects/index.md b/guide/english/certifications/apis-and-microservices/apis-and-microservices-projects/index.md index 512acfdd20..7522542cd3 100644 --- a/guide/english/certifications/apis-and-microservices/apis-and-microservices-projects/index.md +++ b/guide/english/certifications/apis-and-microservices/apis-and-microservices-projects/index.md @@ -1,7 +1,7 @@ --- title: APIs and Microservices Projects --- -## APIs and Microservices Projects +# APIs and Microservices Projects This is a stub. Help our community expand it. diff --git a/guide/english/certifications/apis-and-microservices/apis-and-microservices-projects/request-header-parser-microservice/index.md b/guide/english/certifications/apis-and-microservices/apis-and-microservices-projects/request-header-parser-microservice/index.md index 4383a6c7fa..a3d2e9cde2 100644 --- a/guide/english/certifications/apis-and-microservices/apis-and-microservices-projects/request-header-parser-microservice/index.md +++ b/guide/english/certifications/apis-and-microservices/apis-and-microservices-projects/request-header-parser-microservice/index.md @@ -1,7 +1,7 @@ --- title: Request Header Parser Microservice --- -## Request Header Parser Microservice +# Request Header Parser Microservice This is a stub. Help our community expand it. diff --git a/guide/english/certifications/apis-and-microservices/apis-and-microservices-projects/timestamp-microservice/index.md b/guide/english/certifications/apis-and-microservices/apis-and-microservices-projects/timestamp-microservice/index.md index 4bdd623a2d..2d54db6c04 100644 --- a/guide/english/certifications/apis-and-microservices/apis-and-microservices-projects/timestamp-microservice/index.md +++ b/guide/english/certifications/apis-and-microservices/apis-and-microservices-projects/timestamp-microservice/index.md @@ -2,13 +2,10 @@ title: Timestamp Microservice --- -## Timestamp Microservice +# Timestamp Microservice --- - -![:triangular_flag_on_post:](https://forum.freecodecamp.com/images/emoji/emoji_one/triangular_flag_on_post.png?v=3 ':triangular_flag_on_post:') Remember to use **`Read-Search-Ask`** if you get stuck. Try to pair program ![:busts_in_silhouette:](https://forum.freecodecamp.com/images/emoji/emoji_one/busts_in_silhouette.png?v=3 ':busts_in_silhouette:') and write your own code ![:pencil:](https://forum.freecodecamp.com/images/emoji/emoji_one/pencil.png?v=3 ':pencil:') - -### ![:checkered_flag:](https://forum.freecodecamp.com/images/emoji/emoji_one/checkered_flag.png?v=3 ':checkered_flag:') Problem Explanation: +## Problem Explanation - You need to write a microservice that will return a JSON with the date in Unix format and in a human-readable date format. The JSON format is like the example output, "{"unix":1451001600000, "utc":"Fri, 25 Dec 2015 00:00:00 GMT"}". - The response depends on the URL. If the API endpoint is hit with no additional information, it returns the JSON with the current time. @@ -20,38 +17,37 @@ title: Timestamp Microservice - [Date at MDN:](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) -## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ':speech_balloon:') Hint: 1 + +--- +## Hints + +## Hint: 1 You will need to create the '/api/timestamp/' endpoint separately from the endpoint that reads the date to be parsed from the URL. You won't need a conditional to deal with this endpoint. -> _try to solve the problem now_ -## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ':speech_balloon:') Hint: 2 +## Hint: 2 Date.valueOf() and Date.toUTCString() will generate the correct strings for unix: and utc:. No need to import the Moment library! -> _try to solve the problem now_ -## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ':speech_balloon:') Hint: 3 +## Hint: 3 The Javascript Date object checks for dates that are invalid dates under ISO-8601. Use a Javascript REPL or a short Node script to try it out. [Here is a free online service that lets you test some JS code.:]https://repl.it/site/languages/javascript -> _try to solve the problem now_ -## Spoiler Alert! -![warning sign](https://discourse-user-assets.s3.amazonaws.com/original/2X/2/2d6c412a50797771301e7ceabd554cef4edcd74d.gif) +--- +## Solutions -**Solution ahead!** - -## ![:beginner:](https://forum.freecodecamp.com/images/emoji/emoji_one/beginner.png?v=3 ':beginner:') Basic Code Solution: +
Solution 1 (Click to Show/Hide) ```javascript -app.get('/api/timestamp/', (req, res) => { +app.get("/api/timestamp/", (req, res) => { res.json({ unix: Date.now(), utc: Date() }); }); -app.get('/api/timestamp/:date_string', (req, res) => { +app.get("/api/timestamp/:date_string", (req, res) => { let dateString = req.params.date_string; //A 4 digit number is a valid ISO-8601 for the beginning of that year @@ -64,15 +60,15 @@ app.get('/api/timestamp/:date_string', (req, res) => { let dateObject = new Date(dateString); - if (dateObject.toString() === 'Invalid Date') { - res.json({ error: 'Invaid Date' }); + if (dateObject.toString() === "Invalid Date") { + res.json({ error: "Invaid Date" }); } else { res.json({ unix: dateObject.valueOf(), utc: dateObject.toUTCString() }); } }); ``` -### Code Explanation: +#### Code Explanation - This is a pretty straightforward application of the lessons, Basic Node and Express - Serve JSON on a Specific Route and Basic Node and Express - Get Route Parameter Input from the Client. The added wrinkle is the use of Javascript's native Date object. @@ -81,9 +77,4 @@ app.get('/api/timestamp/:date_string', (req, res) => { That's it. There is no intermediate or advanced solution yet. If you have a better, more elegant solution, help us all out and contribute them! -## ![:clipboard:](https://forum.freecodecamp.com/images/emoji/emoji_one/clipboard.png?v=3 ':clipboard:') NOTE TO CONTRIBUTORS: - -- ![:warning:](https://forum.freecodecamp.com/images/emoji/emoji_one/warning.png?v=3 ':warning:') **DO NOT** add solutions that are similar to any existing solutions. If you think it is **_similar but better_**, then try to merge (or replace) the existing similar solution. -- Add an explanation of your solution. -- Categorize the solution in one of the following categories -- **Basic**, **Intermediate** and **Advanced**. ![:traffic_light:](https://forum.freecodecamp.com/images/emoji/emoji_one/traffic_light.png?v=3 ':traffic_light:') - +
\ No newline at end of file diff --git a/guide/english/certifications/apis-and-microservices/apis-and-microservices-projects/url-shortener-microservice/index.md b/guide/english/certifications/apis-and-microservices/apis-and-microservices-projects/url-shortener-microservice/index.md index ad2f7921e5..3bf4b1b920 100644 --- a/guide/english/certifications/apis-and-microservices/apis-and-microservices-projects/url-shortener-microservice/index.md +++ b/guide/english/certifications/apis-and-microservices/apis-and-microservices-projects/url-shortener-microservice/index.md @@ -1,11 +1,19 @@ --- title: URL Shortener Microservice --- -## URL Shortener Microservice +# URL Shortener Microservice +--- +## Problem Explanation The core features to complete this exercise are the creation and retrieval of URLs from the Database. -## Creating Short URL + +--- +## Hints + +### Hint 1 + +Creating Short URL - Connect to your database instance. > **Note**: It's important to check your Mongoose connection status before dive into the problem, just to check if everything is okay with your database configuration. This should help: `mongoose.connection.readyState` - Receive a POST request containing an URL to be saved on Database. @@ -16,11 +24,10 @@ The core features to complete this exercise are the creation and retrieval of UR - There is a bunch of samples over the internet how to generate some kind of identifier, try to explore it or create your own. - An example of how this should look like: `{'url': www.freecodecamp.org, 'hash': 'ef49fa8b4'}` -## Retrieving Short URL +### Hint 2 +Retrieving Short URL - Receive a GET request containing an identifier used to find a stored URL. - Try to find one URL saved for this identifier - Redirect user to URL. > **Note**: The `res.redirect(url)` function need that the given url, has a defined protocol (http://, https://), or it will just concatenate it as an extension of your current domain. eg: Good URL: `https://www.freecodecamp.org`, Bad URL: `www.freecodecamp.org`. Try it out. - Remember to handle error situations with proper response like, `res.json({"error":"invalid URL"}); - - diff --git a/guide/english/certifications/apis-and-microservices/basic-node-and-express/chain-middleware-to-create-a-time-server/index.md b/guide/english/certifications/apis-and-microservices/basic-node-and-express/chain-middleware-to-create-a-time-server/index.md index 04c412602b..1d19db8cda 100644 --- a/guide/english/certifications/apis-and-microservices/basic-node-and-express/chain-middleware-to-create-a-time-server/index.md +++ b/guide/english/certifications/apis-and-microservices/basic-node-and-express/chain-middleware-to-create-a-time-server/index.md @@ -1,41 +1,61 @@ --- title: Chain Middleware to Create a Time Server --- -## Chain Middleware to Create a Time Server +# Chain Middleware to Create a Time Server - +--- +## Problem Explanation Similar to the last challenge, but now we are chaining 2 functions together. It seems complicated, but it's just JavaScript. -### Hint + +--- +## Hints + +### Hint 1 Instead of responding with the time we can also add any arbitrary property to the request object and pass it to the next function by calling the `next()` method. This is trivial, but it makes for a decent example. The code will looks like this: ```javascript -app.get("/now", (req, res, next) => { - // adding a new property to req object - // in the middleware function - req.string = "example"; - next(); -}, (req, res) => { - // accessing the newly added property - // in the main function - res.send(req.string); -}); +app.get( + "/now", + (req, res, next) => { + // adding a new property to req object + // in the middleware function + req.string = "example"; + next(); + }, + (req, res) => { + // accessing the newly added property + // in the main function + res.send(req.string); + } +); ``` -### Solution + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) ```javascript -app.get("/now", (req, res, next) => { - req.time = new Date().toString(); - next(); -}, (req, res) => { - res.send({ - time: req.time - }); -}); +app.get( + "/now", + (req, res, next) => { + req.time = new Date().toString(); + next(); + }, + (req, res) => { + res.send({ + time: req.time + }); + } +); ``` +
+ +
Solution 2 (Click to Show/Hide) You can also declare the middleware beforehand to use in multiple routes as shown below: @@ -51,3 +71,5 @@ app.get("/now", middleware, (req, res) => { }); }); ``` + +
\ No newline at end of file diff --git a/guide/english/certifications/apis-and-microservices/basic-node-and-express/get-data-from-post-requests/index.md b/guide/english/certifications/apis-and-microservices/basic-node-and-express/get-data-from-post-requests/index.md index 2d1c963a02..d5f0902443 100644 --- a/guide/english/certifications/apis-and-microservices/basic-node-and-express/get-data-from-post-requests/index.md +++ b/guide/english/certifications/apis-and-microservices/basic-node-and-express/get-data-from-post-requests/index.md @@ -1,31 +1,35 @@ --- title: Get Data from POST Requests --- -## Get Data from POST Requests - - - +# Get Data from POST Requests +--- +## Problem Explanation Just like using req.query we can do req.body to get our data. This challenge is very similar to "Get Query Parameter Input from the Client." In order to get data from a post request a general format is: -## Hint + +--- +## Hints + +### Hint 1 ```javascript app.post(PATH, function(req, res) { // Handle the data in the request }); ``` -## Solution + +--- +## Solutions +
Solution 1 (Click to Show/Hide) + ```javascript -app.post('/name', function(req, res) { +app.post("/name", function(req, res) { // Handle the data in the request - var string = req.body.first+ ' '+req.body.last; - res.json({"name": string}); + var string = req.body.first + " " + req.body.last; + res.json({ name: string }); }); ``` - - - -Help our community expand these hints and guides. +
diff --git a/guide/english/certifications/apis-and-microservices/basic-node-and-express/get-query-parameter-input-from-the-client/index.md b/guide/english/certifications/apis-and-microservices/basic-node-and-express/get-query-parameter-input-from-the-client/index.md index b998e75835..3fabba2131 100644 --- a/guide/english/certifications/apis-and-microservices/basic-node-and-express/get-query-parameter-input-from-the-client/index.md +++ b/guide/english/certifications/apis-and-microservices/basic-node-and-express/get-query-parameter-input-from-the-client/index.md @@ -1,13 +1,18 @@ --- title: Get Query Parameter Input from the Client --- -## Get Query Parameter Input from the Client +# Get Query Parameter Input from the Client - +--- +## Problem Explanation Given the endpoint URL, `/name?first=firstname&last=lastname`, we can extract the query parameters (`first` and `last`) and their corresponding values from the `req.query` object and send a custom JSON response containing values derived from the query parameters to the client. -### Solution + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) ```javascript app.get("/name", function(req, res) { @@ -21,3 +26,4 @@ app.get("/name", function(req, res) { }); }); ``` +
diff --git a/guide/english/certifications/apis-and-microservices/basic-node-and-express/get-route-parameter-input-from-the-client/index.md b/guide/english/certifications/apis-and-microservices/basic-node-and-express/get-route-parameter-input-from-the-client/index.md index f865180dc8..a663ef3751 100644 --- a/guide/english/certifications/apis-and-microservices/basic-node-and-express/get-route-parameter-input-from-the-client/index.md +++ b/guide/english/certifications/apis-and-microservices/basic-node-and-express/get-route-parameter-input-from-the-client/index.md @@ -1,13 +1,17 @@ --- title: Get Route Parameter Input from the Client --- -## Get Route Parameter Input from the Client - - +# Get Route Parameter Input from the Client +--- +## Problem Explanation If someone tells you to build a GET or POST endpoint you would achieve the same using `app.get(...)` or `app.post(...)` accordingly. -## Hint + +--- +## Hints + +## Hint #1 In order to get route parameters from a POST request, the general format is as follows: @@ -23,7 +27,11 @@ app.post("/:param1/:param2", (req, res) => { }); ``` -## Solution + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) ```javascript app.get("/:word/echo", (req, res) => { @@ -33,3 +41,4 @@ app.get("/:word/echo", (req, res) => { }); }); ``` +
diff --git a/guide/english/certifications/apis-and-microservices/basic-node-and-express/implement-a-root-level-request-logger-middleware/index.md b/guide/english/certifications/apis-and-microservices/basic-node-and-express/implement-a-root-level-request-logger-middleware/index.md index 70b19e1692..0ccf5f1525 100644 --- a/guide/english/certifications/apis-and-microservices/basic-node-and-express/implement-a-root-level-request-logger-middleware/index.md +++ b/guide/english/certifications/apis-and-microservices/basic-node-and-express/implement-a-root-level-request-logger-middleware/index.md @@ -1,12 +1,19 @@ --- title: Implement a Root-Level Request Logger Middleware --- -## Implement a Root-Level Request Logger Middleware +# Implement a Root-Level Request Logger Middleware - +--- +## Problem Explanation It is easier to write this challenge all at the top (there is already a stub for it). This is because middleware must be placed the function calls you want it to be used for. + +--- +## Hints + +### Hint 1 + To set up your own middleware you can do it like so: ```javascript @@ -15,14 +22,13 @@ app.use(function middleware(req, res, next) { // Call the next function in line: next(); }); - ``` If you have trouble formatting the string correctly, one way to do it looks like: ```javascript - var string = req.method + ' ' + req.path + ' - ' + req.ip; +var string = req.method + " " + req.path + " - " + req.ip; ``` -### Resources +#### Relevant Links - [Express Middleware](https://expressjs.com/en/guide/using-middleware.html) diff --git a/guide/english/certifications/apis-and-microservices/basic-node-and-express/index.md b/guide/english/certifications/apis-and-microservices/basic-node-and-express/index.md index 3ddf236cc5..38103fc05b 100644 --- a/guide/english/certifications/apis-and-microservices/basic-node-and-express/index.md +++ b/guide/english/certifications/apis-and-microservices/basic-node-and-express/index.md @@ -1,7 +1,7 @@ --- title: Basic Node and Express --- -## Basic Node and Express +# Basic Node and Express This is a stub. Help our community expand it. diff --git a/guide/english/certifications/apis-and-microservices/basic-node-and-express/meet-the-node-console/index.md b/guide/english/certifications/apis-and-microservices/basic-node-and-express/meet-the-node-console/index.md index f4fd61b3ef..0147c33e4c 100644 --- a/guide/english/certifications/apis-and-microservices/basic-node-and-express/meet-the-node-console/index.md +++ b/guide/english/certifications/apis-and-microservices/basic-node-and-express/meet-the-node-console/index.md @@ -1,21 +1,20 @@ --- title: Meet the Node console --- -## Meet the Node console - - +# Meet the Node console +--- +## Problem Explanation Make sure you have cloned the correct repository/glitch project and are writing your code in myapp.js. There are many methods available from the node console. You can find a list of these methods with Node.js documentation here. A common use would be to log errors such as: ```javascript - - console.log("An error happened"); +console.log("An error happened"); ``` -### If you use Glitch +**Note:** If you use Glitch - Glitch had changed the 'Logs' button to 'Status' button, still on the top-left, under the app name - Don't submit the 'Edit' page directly. Click the 'Show' button (on top) and submit the application show page's url (url format is like https://appname.glitch.me/) diff --git a/guide/english/certifications/apis-and-microservices/basic-node-and-express/serve-an-html-file/index.md b/guide/english/certifications/apis-and-microservices/basic-node-and-express/serve-an-html-file/index.md index 6d5c9630e6..ada144b16c 100644 --- a/guide/english/certifications/apis-and-microservices/basic-node-and-express/serve-an-html-file/index.md +++ b/guide/english/certifications/apis-and-microservices/basic-node-and-express/serve-an-html-file/index.md @@ -1,18 +1,18 @@ --- title: Serve an HTML File --- -## Serve an HTML File - - +# Serve an HTML File +--- +## Problem Explanation You probably need to comment out the last challenge. If you have a website and want to serve an index.html file you probably want to put this in a public folder. This is to ensure the public doesn't see something you dont want them to, and it sometimes is called "public" or "views," but you can technically call it whatever you want. To serve an index.html in a folder called "public" at the root domain you would do so like this: ```javascript - app.get("/", function(req, res) { - res.sendFile( __dirname + "/public/index.html"); - }); +app.get("/", function(req, res) { + res.sendFile(__dirname + "/public/index.html"); +}); ``` -Note: __dirname returns the root directory is a best practice for node developers. +**Note:** __dirname returns the root directory is a best practice for node developers. diff --git a/guide/english/certifications/apis-and-microservices/basic-node-and-express/serve-json-on-a-specific-route/index.md b/guide/english/certifications/apis-and-microservices/basic-node-and-express/serve-json-on-a-specific-route/index.md index 026a93e8ad..49535cef0d 100644 --- a/guide/english/certifications/apis-and-microservices/basic-node-and-express/serve-json-on-a-specific-route/index.md +++ b/guide/english/certifications/apis-and-microservices/basic-node-and-express/serve-json-on-a-specific-route/index.md @@ -1,16 +1,17 @@ --- title: Serve JSON on a Specific Route --- -## Serve JSON on a Specific Route +# Serve JSON on a Specific Route - +--- +## Problem Explanation It is rather simple to serve a JSON object with Node (at the `/json` route), if we want to deliver an object containing a key `message` and with the value `"Hello json"` we can do so as indicated: ```javascript app.get("/json", (req, res) => { - res.json({ - "message": "Hello json" - }); + res.json({ + message: "Hello json" + }); }); ``` diff --git a/guide/english/certifications/apis-and-microservices/basic-node-and-express/serve-static-assets/index.md b/guide/english/certifications/apis-and-microservices/basic-node-and-express/serve-static-assets/index.md index 89093af8cb..055ccebffa 100644 --- a/guide/english/certifications/apis-and-microservices/basic-node-and-express/serve-static-assets/index.md +++ b/guide/english/certifications/apis-and-microservices/basic-node-and-express/serve-static-assets/index.md @@ -1,10 +1,10 @@ --- title: Serve Static Assets --- -## Serve Static Assets - - +# Serve Static Assets +--- +## Problem Explanation Serving static webpages and assets is fairly simple with `express`. This could be useful for building your own portfolio website or blog, single-page web applications etc. To serve static assets from the `public` folder in the you can use the `express.static()` method as the middleware. This method takes the endpoint and the absolute path to the directory containing the static assets as arguments and exposes the files in that folder at the given endpoint. By default, if the endpoint is not passed to the method, the folder is exposed at the root endpoint i.e. `/` for the application. diff --git a/guide/english/certifications/apis-and-microservices/basic-node-and-express/start-a-working-express-server/index.md b/guide/english/certifications/apis-and-microservices/basic-node-and-express/start-a-working-express-server/index.md index 7cbb040161..16f2ff509d 100644 --- a/guide/english/certifications/apis-and-microservices/basic-node-and-express/start-a-working-express-server/index.md +++ b/guide/english/certifications/apis-and-microservices/basic-node-and-express/start-a-working-express-server/index.md @@ -1,9 +1,13 @@ --- title: Start a Working Express Server --- -## Start a Working Express Server +# Start a Working Express Server - + +--- +## Hints + +### Hint 1 If you had a website at "example.com/" and wanted to serve a string such as "Hello Express" to whoever visits the root domain you could do so easily using Node and/or express: diff --git a/guide/english/certifications/apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests/index.md b/guide/english/certifications/apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests/index.md index a28439f57f..67eff8f0b4 100644 --- a/guide/english/certifications/apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests/index.md +++ b/guide/english/certifications/apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests/index.md @@ -1,16 +1,16 @@ --- title: Use body-parser to Parse POST Requests --- -## Use body-parser to Parse POST Requests - - +# Use body-parser to Parse POST Requests +--- +## Problem Explanation The body-parser should already be added to your project if you used the provided boilerplate, but if not it should be there as: ```json "dependencies": { "body-parser": "^1.19.0", - ... + "express": "^4.17.1" } ``` @@ -22,7 +22,7 @@ This guide assumes you have imported the `body-parser` module into your file as In order to import the same, you just need to add the following line at the top of your file: ```javascript -var bodyParser = require('body-parser'); +var bodyParser = require("body-parser"); ``` All you need to do for this challenge is pass the middleware to `app.use()`. Make sure it comes before the paths it needs to be used on. Remember that body-parser returns with `bodyParser.urlencoded({extended: false})`. Use the following as a template: diff --git a/guide/english/certifications/apis-and-microservices/basic-node-and-express/use-the-.env-file/index.md b/guide/english/certifications/apis-and-microservices/basic-node-and-express/use-the-.env-file/index.md index 05470046b4..d1ddf097b0 100644 --- a/guide/english/certifications/apis-and-microservices/basic-node-and-express/use-the-.env-file/index.md +++ b/guide/english/certifications/apis-and-microservices/basic-node-and-express/use-the-.env-file/index.md @@ -1,24 +1,22 @@ --- title: Use the .env File --- -## Use the .env File - - - +# Use the .env File +--- +## Problem Explanation We can use the .toUpperCase() method to make a string all caps, such as: ```javascript - var response = "Hello World".toUpperCase(); // now becomes "HELLO WORLD" +var response = "Hello World".toUpperCase(); // now becomes "HELLO WORLD" ``` All we need to do now is check what the value of the environment variable is, which you can do like: ```javascript - if (process.env.VAR_NAME === "allCaps") { - response = "Hello World".toUpperCase(); - } else { - response = "Hello World"; - } - }); +if (process.env.VAR_NAME === "allCaps") { + response = "Hello World".toUpperCase(); +} else { + response = "Hello World"; +} ``` diff --git a/guide/english/certifications/apis-and-microservices/index.md b/guide/english/certifications/apis-and-microservices/index.md index 9d2f375744..943715a760 100644 --- a/guide/english/certifications/apis-and-microservices/index.md +++ b/guide/english/certifications/apis-and-microservices/index.md @@ -1,7 +1,7 @@ --- title: APIs and Microservices --- -## APIs and Microservices +# APIs and Microservices This is a stub. Help our community expand it. diff --git a/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/add-a-description-to-your-package.json/index.md b/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/add-a-description-to-your-package.json/index.md index 6bbf249c79..30ae9fe7d2 100644 --- a/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/add-a-description-to-your-package.json/index.md +++ b/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/add-a-description-to-your-package.json/index.md @@ -1,7 +1,15 @@ --- title: Add a Description to Your package.json --- -## Add a Description to Your package.json +# Add a Description to Your package.json + + +--- +## Solutions + + +
Solution 1 (Click to Show/Hide) + To complete the challenge follow the below steps: * Go to the link given in the curriculum starting intro page. ![freecodecamp apis-and-microservices intro](https://user-images.githubusercontent.com/15084301/45616545-65732480-ba8d-11e8-9893-412ff6c68be5.png) @@ -12,3 +20,5 @@ To complete the challenge follow the below steps: ![Glitch public project link](https://user-images.githubusercontent.com/15084301/45616579-8176c600-ba8d-11e8-8a46-4ac930578e74.png) * Submit the link in the solution and that's it. ![sucess page](https://user-images.githubusercontent.com/15084301/45616757-019d2b80-ba8e-11e8-8b5b-98dc6d02c235.png) + +
\ No newline at end of file diff --git a/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/add-a-license-to-your-package.json/index.md b/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/add-a-license-to-your-package.json/index.md index e1d204a539..fbc6208a64 100644 --- a/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/add-a-license-to-your-package.json/index.md +++ b/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/add-a-license-to-your-package.json/index.md @@ -1,13 +1,15 @@ --- title: Add a License to Your package.json --- -## Add a License to Your package.json +# Add a License to Your package.json - + +--- +## Hints + +### Hint 1 You should go over to the `package.json` file in your project. Licenses follow a similar convention as this: ```json "license": "ExampleLicense" ``` - -Help our community expand these hints and guides. diff --git a/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/add-a-version-to-your-package.json/index.md b/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/add-a-version-to-your-package.json/index.md index bcad32b4fc..ac403f1bb7 100644 --- a/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/add-a-version-to-your-package.json/index.md +++ b/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/add-a-version-to-your-package.json/index.md @@ -1,9 +1,13 @@ --- title: Add a Version to Your package.json --- -## Add a Version to Your package.json +# Add a Version to Your package.json - + +--- +## Hints + +### Hint 1 You should go over to the package.json file in your project. Versions follow a similar convention as this: ```json diff --git a/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/add-keywords-to-your-package.json/index.md b/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/add-keywords-to-your-package.json/index.md index 6d6eedfb94..ebcb6bbe07 100644 --- a/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/add-keywords-to-your-package.json/index.md +++ b/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/add-keywords-to-your-package.json/index.md @@ -1,7 +1,11 @@ --- title: Add Keywords to Your package.json --- -## Add Keywords to Your package.json +# Add Keywords to Your package.json + + +--- +## Hints ## Hint 1 * Your package.json should contain the property `keywords`. @@ -12,7 +16,14 @@ title: Add Keywords to Your package.json ## Hint 3 * One of the values in `keywords` should be `freecodecamp`. -## Solution: -```js + +--- +## Solutions +
Solution 1 (Click to Show/Hide) + +```json + "keywords": [ "freecodecamp", "microservice", "guide" ] ``` + +
\ No newline at end of file diff --git a/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/expand-your-project-with-external-packages-from-npm/index.md b/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/expand-your-project-with-external-packages-from-npm/index.md index c2ab98754f..41d992f18d 100644 --- a/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/expand-your-project-with-external-packages-from-npm/index.md +++ b/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/expand-your-project-with-external-packages-from-npm/index.md @@ -1,9 +1,10 @@ --- title: Expand Your Project with External Packages from npm --- -## Expand Your Project with External Packages from npm +# Expand Your Project with External Packages from npm - +--- +## Problem Explanation The `package.json` file in the root directory of your project, among other things, lists all the dependencies that your project needs in order to work, are listed under the `dependencies` key in that file and follow a similar convention as given below: diff --git a/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/how-to-use-package.json-the-core-of-any-node.js-project-or-npm-package/index.md b/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/how-to-use-package.json-the-core-of-any-node.js-project-or-npm-package/index.md index ea0660bb9d..a9972e52a4 100644 --- a/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/how-to-use-package.json-the-core-of-any-node.js-project-or-npm-package/index.md +++ b/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/how-to-use-package.json-the-core-of-any-node.js-project-or-npm-package/index.md @@ -1,8 +1,10 @@ --- title: How to Use package.json, the Core of Any Node.js Project or npm Package --- -## How to Use package.json, the Core of Any Node.js Project or npm Package +# How to Use package.json, the Core of Any Node.js Project or npm Package +--- +## Problem Explanation According to [this issue discussed on freeCodeCamp's git repo](https://github.com/freeCodeCamp/freeCodeCamp/issues/34798), the bootstrapped glitch project in the [introduction](https://learn.freecodecamp.org/apis-and-microservices/managing-packages-with-npm/) will NOT work if you're not logged in on glitch. Here's how to set up a new node/express project anonymously: @@ -24,9 +26,13 @@ Remember, you're writing JSON, so make sure you use 2. `"key": value` format 3. the correct number of commas -SPOILER ALERT. DO NOT SCROLL DOWN IF YOU WISH TO KEEP TRYING - - ```json + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) + +```json { "name": "fcc-learn-npm-package-json", "author": "foobar", @@ -45,4 +51,6 @@ SPOILER ALERT. DO NOT SCROLL DOWN IF YOU WISH TO KEEP TRYING "url": "https://idontknow/todo.git" } } - ``` +``` + +
\ No newline at end of file diff --git a/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/index.md b/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/index.md index 1e2d969818..4678046187 100644 --- a/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/index.md +++ b/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/index.md @@ -1,7 +1,7 @@ --- title: Managing Packages with NPM --- -## Managing Packages with NPM +# Managing Packages with NPM NPM stands for Node Package Manager. It is a Package Manager bundled with Node.js. A Package bundles code in a manner that makes it easy to plugin or install the application or software contained within the package. There are many package managers, such as APT, Yarn, and NPM, that perform operations related to installing and configuring software packages to work on the system that the package manager is installed on. NPM is vital to Node, as it allows for easy management of Middleware such as Express. diff --git a/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/manage-npm-dependencies-by-understanding-semantic-versioning/index.md b/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/manage-npm-dependencies-by-understanding-semantic-versioning/index.md index ae6fc0e232..60027e52cd 100644 --- a/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/manage-npm-dependencies-by-understanding-semantic-versioning/index.md +++ b/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/manage-npm-dependencies-by-understanding-semantic-versioning/index.md @@ -1,9 +1,13 @@ --- title: Manage npm Dependencies By Understanding Semantic Versioning --- -## Manage npm Dependencies By Understanding Semantic Versioning +# Manage npm Dependencies By Understanding Semantic Versioning - + +--- +## Hints + +### Hint 1 You should go over to the `package.json` file in your project. SemVer dependencies follow a similar convention like this: ```json @@ -13,4 +17,3 @@ You should go over to the `package.json` file in your project. SemVer dependenci ... ``` -This is a stub. Help our community expand it. diff --git a/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/remove-a-package-from-your-dependencies/index.md b/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/remove-a-package-from-your-dependencies/index.md index 9b46c6eecb..f2575e323e 100644 --- a/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/remove-a-package-from-your-dependencies/index.md +++ b/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/remove-a-package-from-your-dependencies/index.md @@ -1,9 +1,13 @@ --- title: Remove a Package from Your Dependencies --- -## Remove a Package from Your Dependencies +# Remove a Package from Your Dependencies - + +--- +## Hints + +### Hint 1 You should go over to the `package.json` file in your project. Removing a package is as simple as going into your dependencies section and removing the line with the corresponding item. In the following example "express" is removed from `package.json`: Before @@ -19,5 +23,4 @@ After "dependencies": { "express": "^4.16.4", }, -``` -This is a stub. Help our community expand it. +``` \ No newline at end of file diff --git a/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/use-the-caret-character-to-use-the-latest-minor-version-of-a-dependency/index.md b/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/use-the-caret-character-to-use-the-latest-minor-version-of-a-dependency/index.md index 18b0504516..153f451019 100644 --- a/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/use-the-caret-character-to-use-the-latest-minor-version-of-a-dependency/index.md +++ b/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/use-the-caret-character-to-use-the-latest-minor-version-of-a-dependency/index.md @@ -1,7 +1,11 @@ --- title: Use the Caret-Character to Use the Latest Minor Version of a Dependency --- -## Use the Caret-Character to Use the Latest Minor Version of a Dependency +# Use the Caret-Character to Use the Latest Minor Version of a Dependency + + +--- +## Hints ## Hint 1 * the package `moment` should be in your package.json, specifically in the @@ -10,9 +14,15 @@ dependencies property. ## Hint 2 * `moment` version should have a caret character within it. -## Solution: -```js + +--- +## Solutions +
Solution 1 (Click to Show/Hide) + +```json + "dependencies": { "moment": "^2.10.2" } ``` +
diff --git a/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/use-the-tilde-character-to-always-use-the-latest-patch-version-of-a-dependency/index.md b/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/use-the-tilde-character-to-always-use-the-latest-patch-version-of-a-dependency/index.md index 5a35f8eb86..bfc39777ed 100644 --- a/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/use-the-tilde-character-to-always-use-the-latest-patch-version-of-a-dependency/index.md +++ b/guide/english/certifications/apis-and-microservices/managing-packages-with-npm/use-the-tilde-character-to-always-use-the-latest-patch-version-of-a-dependency/index.md @@ -1,7 +1,7 @@ --- title: Use the Tilde-Character to Always Use the Latest Patch Version of a Dependency --- -## Use the Tilde-Character to Always Use the Latest Patch Version of a Dependency +# Use the Tilde-Character to Always Use the Latest Patch Version of a Dependency This is a stub. Help our community expand it. diff --git a/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/chain-search-query-helpers-to-narrow-search-results/index.md b/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/chain-search-query-helpers-to-narrow-search-results/index.md index a94abea66e..371a616e03 100644 --- a/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/chain-search-query-helpers-to-narrow-search-results/index.md +++ b/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/chain-search-query-helpers-to-narrow-search-results/index.md @@ -1,55 +1,67 @@ --- title: Chain Search Query Helpers to Narrow Search Results --- -## Chain Search Query Helpers to Narrow Search Results +# Chain Search Query Helpers to Narrow Search Results -1. To create but not execute a find query -```javascript -Model.find( {name: 'Leah'} ) -``` -       -2. To store the find query into a variable for later use: -```javascript -var findQuery = YourModel.find( {name: 'Leah'} ) -``` -       +--- +## Hints -3. To sort an array:
+### Hint 1 +To create but not execute a find query ```javascript -yourArray.sort( {age: 1} ) // Here: 1 for ascending order and -1 for descending order. +Model.find({ name: "Leah" }); ``` -       - -4. To limit an array's size: -```javascript -yourArray.limit(5) // return array which has 5 items in it. -``` -       -5. To hide certain property from the result: +### Hint 2 +To store the find query into a variable for later use: ```javascript -yourArray.select( {name: 0, age: 1} ) // Here: 0 means false and thus hide name property; 1 means true so age property will show. +var findQuery = YourModel.find({ name: "Leah" }); ``` -       -6. To execute this query, you can either:
-  1) Callback: +### Hint 3 +To sort an array:
+```javascript +yourArray.sort({ age: 1 }); // Here: 1 for ascending order and -1 for descending order. +``` + +### Hint 4 +To limit an array's size: +```javascript +yourArray.limit(5); // return array which has 5 items in it. +``` + +### Hint 5 +To hide certain property from the result: +```javascript +yourArray.select({ name: 0, age: 1 }); // Here: 0 means false and thus hide name property; 1 means true so age property will show. +``` +### Hint 6 +To execute this query, you can either: +1. Callback: ```javascript YourQuery.exec(function(err, docs) { - //do something here -}) + //do something here +}); ``` -      Or 2) Promise +### Hint 7 +Or + +2. Promise ```javascript YourQuery.exec.then(function(err, docs) { - //do something here -}) + //do something here +}); ``` -7. Chain it all together: +### Hint 8 +Chain it all together: ```javascript -Person.find({age: 55}).sort({name: -1}).limit(5).select( {favoriteFoods: 0} ).exec(function(error, people) { - //do something here -}) +Person.find({ age: 55 }) + .sort({ name: -1 }) + .limit(5) + .select({ favoriteFoods: 0 }) + .exec(function(error, people) { + //do something here + }); ``` diff --git a/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/create-a-model/index.md b/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/create-a-model/index.md index 8414e8f9f2..43c31aa234 100644 --- a/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/create-a-model/index.md +++ b/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/create-a-model/index.md @@ -2,40 +2,47 @@ title: Create a Model --- +# Create a Model + + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) + There are 3 things to do in this challenge. You can click each item to see the code. -
- Assign Mongoose Schema to a variable. This is not necessary but will make your code easier to read. +**Assign Mongoose Schema to a variable** +This is not necessary but will make your code easier to read. ```javascript const Schema = mongoose.Schema; ``` -
See the [Mongoose docs](https://mongoosejs.com/docs/guide.html) first where is a lot of useful stuff. When you are building schema you can use either of three options for name validation -```js +``` + name: String name: {type: String} name: {type: String, required: true} //preferred ``` -
- Create Person schema. +**Create Person schema.** ```javascript const personSchema = new Schema({ name: { type: String, required: true }, age: Number, - favoriteFoods: [String] + favoriteFoods: [String] }); ``` **Note**: If you choose to skip the first step, you have to use `mongoose.Schema` instead of `Schema`. -
-
- Create Person model from the schema. + +**Create Person model from the schema.** ```javascript -const Person = mongoose.model('Person', personSchema); +const Person = mongoose.model("Person", personSchema); ```
+ diff --git a/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/create-and-save-a-record-of-a-model/index.md b/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/create-and-save-a-record-of-a-model/index.md index 02b33361b9..70e5b992fe 100644 --- a/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/create-and-save-a-record-of-a-model/index.md +++ b/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/create-and-save-a-record-of-a-model/index.md @@ -3,9 +3,11 @@ title: Create and Save a Record of a Model --- # Create and Save a Record of a Model + +--- ## Hints -### Hint #1 +### Hint 1 You need to do the following: 1. Create a model of a person, using the schema from exercise 2 @@ -13,9 +15,11 @@ You need to do the following: 3. Save the new person you created 4. Put your new person inside the `createAndSavePerson` function + +--- ## Solutions -
Solution #1 (Click to Show/Hide) +
Solution 1 (Click to Show/Hide) Code for `myApp.js` diff --git a/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/create-many-records-with-model.create/index.md b/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/create-many-records-with-model.create/index.md index 3659aa0c4b..ba4e7934cb 100644 --- a/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/create-many-records-with-model.create/index.md +++ b/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/create-many-records-with-model.create/index.md @@ -3,23 +3,27 @@ title: Create Many Records with model.create() --- # Create Many Records with model.create() + +--- ## Hints -### Hint #1 +### Hint 1 Create an array of objects. Each object has a name, age and an array of favorite foods. Use the variable name `arrayOfPeople`. -### Hint #2 +### Hint 2 Create your many records (ie. create your people) inside the callback for `createManyPeople`. -### Hint #3 +### Hint 3 Use `Model.create()` to create many records. You should replace `Model` with the name of the model you defined in the previous section. Most likely you called your model `Person`. -### Hint #4 +### Hint 4 The `Model.create` function requires a callback, similar to the `person.save` function you used in the previous section. + +--- ## Solutions -
Solution #1 (Click to Show/Hide) +
Solution 1 (Click to Show/Hide) Code for `myApp.js` diff --git a/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/delete-many-documents-with-model.remove/index.md b/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/delete-many-documents-with-model.remove/index.md index 5457d435e5..6df867c4ab 100644 --- a/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/delete-many-documents-with-model.remove/index.md +++ b/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/delete-many-documents-with-model.remove/index.md @@ -1,7 +1,7 @@ --- title: Delete Many Documents with model.remove() --- -## Delete Many Documents with model.remove() +# Delete Many Documents with model.remove() This is a stub. Help our community expand it. diff --git a/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/delete-one-document-using-model.findbyidandremove/index.md b/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/delete-one-document-using-model.findbyidandremove/index.md index 5e2ad39e83..9dbbf3e05a 100644 --- a/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/delete-one-document-using-model.findbyidandremove/index.md +++ b/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/delete-one-document-using-model.findbyidandremove/index.md @@ -1,7 +1,7 @@ --- title: Delete One Document Using model.findByIdAndRemove --- -## Delete One Document Using model.findByIdAndRemove +# Delete One Document Using model.findByIdAndRemove This is a stub. Help our community expand it. diff --git a/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/index.md b/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/index.md index e2c7caf6b5..bef06722a1 100644 --- a/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/index.md +++ b/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/index.md @@ -1,7 +1,7 @@ --- title: MongoDB and Mongoose --- -## MongoDB and Mongoose +# MongoDB and Mongoose This is a stub. Help our community expand it. diff --git a/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/install-and-set-up-mongoose/index.md b/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/install-and-set-up-mongoose/index.md index 4d014daef5..ef4cca19d0 100644 --- a/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/install-and-set-up-mongoose/index.md +++ b/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/install-and-set-up-mongoose/index.md @@ -3,6 +3,8 @@ title: Install and Set Up Mongoose --- # Install and Set Up Mongoose +--- +## Problem Explanation You might want to check both the [MongoDB](https://www.npmjs.com/package/mongodb) and the [Mongoose](https://www.npmjs.com/package/mongoose) NPM Repositories for the manual configuration if you are not using Giltch. OR @@ -10,11 +12,13 @@ OR 1. You can use the glitch feature of search packages, install them and update package.json all by itself. (You should use fresh Glitch project from the url given in MongoDb and Mongoose first intro page). 2. Once done add the MONGO_URL in .env file and save your path as -```` mongodb://:@ds.mlab.com:/ ```` which you copy from mLab. Remember to remove the angle brackets ````< >```` when you replace your username and password of your database. +``` mongodb://:@ds.mlab.com:/ ```` which you copy from mLab. Remember to remove the angle brackets ````< >```` when you replace your username and password of your database. + +--- ## Hints -### Hint #1 +### Hint 1 **Timeout error** If the tests are timing out, check the `package.json` file. Ensure the final dependency does not end in a `,`. @@ -27,7 +31,7 @@ For example, this will result in a timeout error: }, ``` -### Hint #2 +### Hint 2 **add MONGO_URI to .env** * Insert a line that looks similar to: `MONGO_URI=mongodb+srv://:@-vlas9.mongodb.net/test?retryWrites=true`. `` and `` will be automatically generated by MongoDB. @@ -40,9 +44,11 @@ Still having issues? Check the below hints: * Do you have symbols or special characters in your password, e.g. `$&(@`? If so, you will need to translate these into unicode. MongoDB has instructions on how to do this. I would suggest changing your password to be lettes and numbers only for simplicity. + +--- ## Solutions -
Solution #1 (Click to Show/Hide) +
Solution 1 (Click to Show/Hide) **.env** diff --git a/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/perform-classic-updates-by-running-find-edit-then-save/index.md b/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/perform-classic-updates-by-running-find-edit-then-save/index.md index 9ccf8f00ac..35b9b2e3f6 100644 --- a/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/perform-classic-updates-by-running-find-edit-then-save/index.md +++ b/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/perform-classic-updates-by-running-find-edit-then-save/index.md @@ -1,7 +1,7 @@ --- title: Perform Classic Updates by Running Find, Edit, then Save --- -## Perform Classic Updates by Running Find, Edit, then Save +# Perform Classic Updates by Running Find, Edit, then Save This is a stub. Help our community expand it. diff --git a/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/perform-new-updates-on-a-document-using-model.findoneandupdate/index.md b/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/perform-new-updates-on-a-document-using-model.findoneandupdate/index.md index 1dfb826898..9b1fc2eb69 100644 --- a/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/perform-new-updates-on-a-document-using-model.findoneandupdate/index.md +++ b/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/perform-new-updates-on-a-document-using-model.findoneandupdate/index.md @@ -1,7 +1,7 @@ --- title: Perform New Updates on a Document Using model.findOneAndUpdate() --- -## Perform New Updates on a Document Using model.findOneAndUpdate() +# Perform New Updates on a Document Using model.findOneAndUpdate() This is a stub. Help our community expand it. diff --git a/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/use-model.find-to-search-your-database/index.md b/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/use-model.find-to-search-your-database/index.md index 22cd7aabe7..28333be40f 100644 --- a/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/use-model.find-to-search-your-database/index.md +++ b/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/use-model.find-to-search-your-database/index.md @@ -3,17 +3,21 @@ title: Use model.find() to Search Your Database --- # Use model.find() to Search Your Database + +--- ## Hints -### Hint #1 +### Hint 1 Replace `Model` with the name of your model from the previous sections. Most likely this is `Person`. -### Hint #2 +### Hint 2 Use `{name: personName}` for the first argument in `Model.find()`. + +--- ## Solutions -
Solution #1 (Click to Show/Hide) +
Solution 1 (Click to Show/Hide) Code for `myApp.js` diff --git a/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/use-model.findbyid-to-search-your-database-by-id/index.md b/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/use-model.findbyid-to-search-your-database-by-id/index.md index 3080ffd407..1f4d30e265 100644 --- a/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/use-model.findbyid-to-search-your-database-by-id/index.md +++ b/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/use-model.findbyid-to-search-your-database-by-id/index.md @@ -3,9 +3,11 @@ title: Use model.findById() to Search Your Database By _id --- # Use model.findById() to Search Your Database By _id + +--- ## Solutions -
Solution #1 (Click to Show/Hide) +
Solution 1 (Click to Show/Hide) Code for `myApp.js` diff --git a/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/use-model.findone-to-return-a-single-matching-document-from-your-database/index.md b/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/use-model.findone-to-return-a-single-matching-document-from-your-database/index.md index 53ea83d600..c1f96ceb04 100644 --- a/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/use-model.findone-to-return-a-single-matching-document-from-your-database/index.md +++ b/guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/use-model.findone-to-return-a-single-matching-document-from-your-database/index.md @@ -3,9 +3,11 @@ title: Use model.findOne() to Return a Single Matching Document from Your Databa --- # Use model.findOne() to Return a Single Matching Document from Your Database + +--- ## Solutions -
Solution #1 (Click to Show/Hide) +
Solution 1 (Click to Show/Hide) Code for `myApp.js` diff --git a/guide/english/certifications/coding-interview-prep/algorithms/find-the-symmetric-difference/index.md b/guide/english/certifications/coding-interview-prep/algorithms/find-the-symmetric-difference/index.md index 2b215ad46e..5fa695918d 100644 --- a/guide/english/certifications/coding-interview-prep/algorithms/find-the-symmetric-difference/index.md +++ b/guide/english/certifications/coding-interview-prep/algorithms/find-the-symmetric-difference/index.md @@ -2,36 +2,35 @@ title: Find the Symmetric Difference --- -![:triangular_flag_on_post:](https://forum.freecodecamp.com/images/emoji/emoji_one/triangular_flag_on_post.png?v=3 ":triangular_flag_on_post:") Remember to use **`Read-Search-Ask`** if you get stuck. Try to pair program![:busts_in_silhouette:](https://forum.freecodecamp.com/images/emoji/emoji_one/busts_in_silhouette.png?v=3 ":busts_in_silhouette:") and write your own code![:pencil:](https://forum.freecodecamp.com/images/emoji/emoji_one/pencil.png?v=3 ":pencil:") - -### ![:checkered_flag:](https://forum.freecodecamp.com/images/emoji/emoji_one/checkered_flag.png?v=3 ":checkered_flag:") Problem Explanation: ### +# Find the Symmetric Difference +--- +## Problem Explanation Symmetric difference (commonly denoted by Δ) of two sets is the set of elements which are in either of the two sets, but not in both. For example, `sym([1, 2, 3], [5, 2, 1, 4])` should yield `[3, 4, 5]`. Following above definition, symmetric difference of three sets *A*, *B*, and *C* can be expressed as `(A Δ B) Δ C`. -#### Relevant Links #### +#### Relevant Links * [Symmetric difference - Wikipedia](https://en.wikipedia.org/wiki/Symmetric_difference) * [Symmetric difference - YouTube](https://www.youtube.com/watch?v=PxffSUQRkG4) * [Array.reduce()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce) -## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ":speech_balloon:") Hint: 1 ## +--- +## Hints + +### Hint 1 The *arguments* object is *Array*-like object that only inherits `Array.length` property. Hence consider converting it to an actual *Array*. -> _try to solve the problem now_ - -## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ":speech_balloon:") Hint: 2 ## +### Hint 2 Deem writing a helper function that returns the symmetric difference of two arrays on each call instead of attempting to difference all sets simultaneously. -> _try to solve the problem now_ - -## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ":speech_balloon:") Hint: 3 ## +### Hint 3 Apply helper function against the created arguments array reducing its elements pairwise recursively to form the expected output. **Note** @@ -44,103 +43,95 @@ In the event of *odd number of sets* the symmetric difference will include ident (A ⋂ B) ⋂ C = {1, 4} &Intersection {3, 4, 5} A ⋂ B = {1, 3, 5} -> _try to solve the problem now_ -## Spoiler Alert! ## +--- +## Solutions -![:warning:](//discourse-user-assets.s3.amazonaws.com/original/2X/2/2d6c412a50797771301e7ceabd554cef4edcd74d.gif ":warning:") - -**Solution Ahead!** - -## ![:beginner:](https://forum.freecodecamp.com/images/emoji/emoji_one/beginner.png?v=3 ":beginner:") Basic Code Solution: ## +
Solution 1 (Click to Show/Hide) ```javascript - function sym() { - var args = []; - for (var i = 0; i < arguments.length; i++) { - args.push(arguments[i]); +function sym() { + var args = []; + for (var i = 0; i < arguments.length; i++) { + args.push(arguments[i]); + } + + function symDiff(arrayOne, arrayTwo) { + var result = []; + + arrayOne.forEach(function(item) { + if (arrayTwo.indexOf(item) < 0 && result.indexOf(item) < 0) { + result.push(item); } + }); - function symDiff(arrayOne, arrayTwo) { - var result = []; - - arrayOne.forEach(function(item) { - if (arrayTwo.indexOf(item) < 0 && result.indexOf(item) < 0) { - result.push(item); - } - }); - - arrayTwo.forEach(function(item) { - if (arrayOne.indexOf(item) < 0 && result.indexOf(item) < 0) { - result.push(item); - } - }); - - return result; + arrayTwo.forEach(function(item) { + if (arrayOne.indexOf(item) < 0 && result.indexOf(item) < 0) { + result.push(item); } + }); - // Apply reduce method to args array, using the symDiff function - return args.reduce(symDiff); - } + return result; + } + + // Apply reduce method to args array, using the symDiff function + return args.reduce(symDiff); +} ``` -### Code Explanation: ### - +#### Code Explanation * `push()` is used to break down the *arguments* object to an array, *args*. * The `symDiff` function finds the symmetric difference between two sets. It is used as a callback function for the `reduce()` method called on *args*. * `arrayOne.forEach()` pushes the elements to *result* which are present only in *arrayOne* as well as not already a part of *result*. * `arrayTwo.forEach()` pushes the elements to *result* which are present only in *arrayTwo* as well as not already a part of *result*. * The *result*, which is the symmetric difference is returned. This solution works for any number of sets. -#### Relevant Links #### +#### Relevant Links * [Statement for](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/statements/for) * [Array.length](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/length) * [Array.push()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push) * [Array.forEach()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) * [Array.indexOf()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf) +
-## ![:sunflower:](https://forum.freecodecamp.com/images/emoji/emoji_one/sunflower.png?v=3 ":sunflower:") Intermediate Code Solution: ## +
Solution 2 (Click to Show/Hide) ```javascript - function sym() { +function sym() { + // Convert the argument object into a proper array + var args = Array.prototype.slice.call(arguments); - // Convert the argument object into a proper array - var args = Array.prototype.slice.call(arguments); - - // Return the symmetric difference of 2 arrays - var getDiff = function(arr1, arr2) { - - // Returns items in arr1 that don't exist in arr2 - function filterFunction(arr1, arr2) { - return arr1.filter(function(item) { - return arr2.indexOf(item) === -1; - }); - } - - // Run filter function on each array against the other - return filterFunction(arr1, arr2) - .concat(filterFunction(arr2, arr1)); - }; - - // Reduce all arguments getting the difference of them - var summary = args.reduce(getDiff, []); - - // Run filter function to get the unique values - var unique = summary.filter(function(elem, index, self) { - return index === self.indexOf(elem); - }); - return unique; + // Return the symmetric difference of 2 arrays + var getDiff = function(arr1, arr2) { + // Returns items in arr1 that don't exist in arr2 + function filterFunction(arr1, arr2) { + return arr1.filter(function(item) { + return arr2.indexOf(item) === -1; + }); } - // test here - sym([1, 2, 3], [5, 2, 1, 4]); + // Run filter function on each array against the other + return filterFunction(arr1, arr2).concat(filterFunction(arr2, arr1)); + }; + + // Reduce all arguments getting the difference of them + var summary = args.reduce(getDiff, []); + + // Run filter function to get the unique values + var unique = summary.filter(function(elem, index, self) { + return index === self.indexOf(elem); + }); + return unique; +} + +// test here +sym([1, 2, 3], [5, 2, 1, 4]); ``` -### Code Explanation: ### - +#### Code Explanation * The `slice()` method is used to break down the *arguments* object to an array, *args*. * The `getDiff` function finds the symmetric difference between two sets, *arr1* and *arr2*. It is used as a callback function for the `reduce()` method called on *args*. * The first `filterFunction()` returns elements in *arr1* that don't exist in *arr2*. @@ -148,41 +139,36 @@ In the event of *odd number of sets* the symmetric difference will include ident * *summary* consists of the reduced arguments. * `filter()` is used on *summary* to keep only the unique values and *unique* is returned. -#### Relevant Links #### +#### Relevant Links * [Array.slice()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice) * [Array.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) * [Array.concat()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat) +
-## ![:rotating_light:](https://forum.freecodecamp.com/images/emoji/emoji_one/rotating_light.png?v=3 ":rotating_light:") Advanced Code Solution: ## +
Solution 3 (Click to Show/Hide) ```javascript - const diff = (arr1, arr2) => ( - [ - ...arr1.filter(e => !arr2.includes(e)), - ...arr2.filter(e => !arr1.includes(e)), - ] - ); +const diff = (arr1, arr2) => [ + ...arr1.filter(e => !arr2.includes(e)), + ...arr2.filter(e => !arr1.includes(e)) +]; - const sym = (...args) => [...new Set(args.reduce(diff))]; +const sym = (...args) => [...new Set(args.reduce(diff))]; - // test here - sym([1, 2, 3], [5, 2, 1, 4]); +// test here +sym([1, 2, 3], [5, 2, 1, 4]); ``` -### Code Explanation: ### +#### Code Explanation * The main function *sym()* reduces given arrays utilising helper function *diff()* to a single array. Also, it temporary converts the result to *Set* to remove duplicates. * The function *diff()* returns the symmetric difference of two arrays by picking out elements in parameterised arrays; *arr1* and *arr2*. -#### Relevant Links #### +#### Relevant Links * [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) * [Array.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) -## ![:clipboard:](https://forum.freecodecamp.com/images/emoji/emoji_one/clipboard.png?v=3 ":clipboard:") NOTES FOR CONTRIBUTIONS: ## - -* ![:warning:](https://forum.freecodecamp.com/images/emoji/emoji_one/warning.png?v=3 ":warning:") **DO NOT** add solutions that are similar to any existing solutions. If you think it is **_similar but better_**, then try to merge (or replace) the existing similar solution. -* Add an explanation of your solution. -* Categorize the solution in one of the following categories — **Basic**, **Intermediate** and **Advanced**. ![:traffic_light:](https://forum.freecodecamp.com/images/emoji/emoji_one/traffic_light.png?v=3 ":traffic_light:") +
\ No newline at end of file diff --git a/guide/english/certifications/coding-interview-prep/algorithms/implement-bubble-sort/index.md b/guide/english/certifications/coding-interview-prep/algorithms/implement-bubble-sort/index.md index 828fdfd8bb..bb2ea27910 100644 --- a/guide/english/certifications/coding-interview-prep/algorithms/implement-bubble-sort/index.md +++ b/guide/english/certifications/coding-interview-prep/algorithms/implement-bubble-sort/index.md @@ -1,48 +1,58 @@ --- title: Implement Bubble Sort --- -## Implement Bubble Sort +# Implement Bubble Sort -### Method: +--- +## Problem Explanation - Bubble Sort is a sorting algorithm which sorts or *bubbles* the largest number as last element at the end of each pass. - We compare each element to the one ahead of it, if the element before is smaller, we swap their places. - Bubble Sort's time complexity is **O(n2)**. - It's a **stable** algorithm. - ![Bubble sort in action](https://upload.wikimedia.org/wikipedia/commons/c/c8/Bubble-sort-example-300px.gif) -### Solution: -#### Solution 1: Basic +--- +## Solutions + +
Solution 1 (Click to Show/Hide) + ```js -function swap(a, b, arr){ +function swap(a, b, arr) { let tmp = arr[a]; arr[a] = arr[b]; arr[b] = tmp; } function bubbleSort(array) { - for (let i = 0; i < array.length; i++){ - for (let j = 0; j < array.length-1-i; j++){ // -i because the largest element will be bubbled at the end so we don't have to compare. - if (array[j] > array[j+1]){ - swap(j, j+1, array); + for (let i = 0; i < array.length; i++) { + for (let j = 0; j < array.length - 1 - i; j++) { + // -i because the largest element will be bubbled at the end so we don't have to compare. + if (array[j] > array[j + 1]) { + swap(j, j + 1, array); } } } return array; } ``` -#### Solution 2: Advanced +
+ +
Solution 2 (Click to Show/Hide) + ```js function bubbleSort(array) { - for (let i = 0; i < array.length; i++){ - for (let j = 0; j < array.length-1-i; j++){ - if (array[j] > array[j+1]) [array[j], array[j+1]] = [array[j+1], array[j]]; // Using ES6 array destructuring to swap + for (let i = 0; i < array.length; i++) { + for (let j = 0; j < array.length - 1 - i; j++) { + if (array[j] > array[j + 1]) + [array[j], array[j + 1]] = [array[j + 1], array[j]]; // Using ES6 array destructuring to swap } } return array; } - ``` +``` - ### References: + #### Relevant Links - [GeeksForGeeks](https://www.geeksforgeeks.org/bubble-sort/) - [Wikipedia](https://en.wikipedia.org/wiki/Bubble_sort) - Video by [HackerRank](https://www.youtube.com/watch?v=6Gv8vg0kcHc) +
diff --git a/guide/english/certifications/coding-interview-prep/algorithms/implement-insertion-sort/index.md b/guide/english/certifications/coding-interview-prep/algorithms/implement-insertion-sort/index.md index ec7f9e7495..ee570da56c 100644 --- a/guide/english/certifications/coding-interview-prep/algorithms/implement-insertion-sort/index.md +++ b/guide/english/certifications/coding-interview-prep/algorithms/implement-insertion-sort/index.md @@ -1,9 +1,10 @@ --- title: Implement Insertion Sort --- -## Implement Insertion Sort +# Implement Insertion Sort -### Method: +--- +## Problem Explanation - Insertion Sort assumes that array is divided in two parts: 1. Sorted (Initially the first element) 2. Unsorted @@ -13,21 +14,27 @@ title: Implement Insertion Sort - Time comlexity of Insertion sort is of **O(n2)**. - It's a **stable** algorithm. -### Solution: + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) + ```js function insertionSort(array) { - for (let i = 1; i < array.length; i++){ + for (let i = 1; i < array.length; i++) { let curr = array[i]; - for (var j = i-1; j >= 0 && array[j] > curr; j--){ - array[j+1] = array[j]; + for (var j = i - 1; j >= 0 && array[j] > curr; j--) { + array[j + 1] = array[j]; } - array[j+1] = curr; + array[j + 1] = curr; } return array; } ``` -### References: +#### Relevant Links - [Wikipedia](https://en.wikipedia.org/wiki/Insertion_sort) - [Khan Academy](https://www.youtube.com/watch?v=lCzQvQr8Utw) +
diff --git a/guide/english/certifications/coding-interview-prep/algorithms/implement-merge-sort/index.md b/guide/english/certifications/coding-interview-prep/algorithms/implement-merge-sort/index.md index 9e42190aa1..678c75f16e 100644 --- a/guide/english/certifications/coding-interview-prep/algorithms/implement-merge-sort/index.md +++ b/guide/english/certifications/coding-interview-prep/algorithms/implement-merge-sort/index.md @@ -1,9 +1,10 @@ --- title: Implement Merge Sort --- -## Implement Merge Sort +# Implement Merge Sort -### Method: +--- +## Problem Explanation - Merge Sort is a classic divide and conquer problem. - The following steps are involved: - Divide: We break the array from the middle using recusion until we're left with 1 element. @@ -14,19 +15,26 @@ title: Implement Merge Sort - It's a **stable** algorithm. - ![Merge Sort in action](https://upload.wikimedia.org/wikipedia/commons/c/cc/Merge-sort-example-300px.gif) -### Solution: + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) + ```js //Merger function, which merges 2 sorted array into 1 sorted array -function merger(arr1, arr2){ - let i = 0, j = 0, mergedArr = []; - while (i < arr1.length && j < arr2.length){ +function merger(arr1, arr2) { + let i = 0, + j = 0, + mergedArr = []; + while (i < arr1.length && j < arr2.length) { if (arr1[i] > arr2[j]) mergedArr.push(arr2[j++]); else mergedArr.push(arr1[i++]); } - while (i < arr1.length){ + while (i < arr1.length) { mergedArr.push(arr1[i++]); } - while (j < arr2.length){ + while (j < arr2.length) { mergedArr.push(arr2[j++]); } return mergedArr; @@ -34,17 +42,18 @@ function merger(arr1, arr2){ function mergeSort(array) { //Array of length 1 is sorted so we return the same array back if (array.length == 1) return array; - + //Break down the array to half from middle into left and right - let middle = Math.floor(array.length/2); + let middle = Math.floor(array.length / 2); let left = mergeSort(array.slice(0, middle)); - let right = mergeSort(array.slice(middle)); - + let right = mergeSort(array.slice(middle)); + //Return the merged sorted array return merger(left, right); } ``` -### References: +#### Relevant Links - [Wikipedia](https://en.wikipedia.org/wiki/Merge_sort) - Video by [Hackerrank](https://www.youtube.com/watch?v=KF2j-9iSf4Q) +
diff --git a/guide/english/certifications/coding-interview-prep/algorithms/implement-quick-sort/index.md b/guide/english/certifications/coding-interview-prep/algorithms/implement-quick-sort/index.md index 23a2b6ca31..7d8b8ab5fb 100644 --- a/guide/english/certifications/coding-interview-prep/algorithms/implement-quick-sort/index.md +++ b/guide/english/certifications/coding-interview-prep/algorithms/implement-quick-sort/index.md @@ -1,9 +1,10 @@ --- title: Implement Quick Sort --- -## Implement Quick Sort +# Implement Quick Sort -### Method: +--- +## Problem Explanation - Quick sort is an efficient sorting algorithm. It's an in-place algorithm so it doesn't take any auxilary space. - First pick a random pivot point around which move all the smaller elements to it to the left of it and the bigger elements to the right of it. - After getting the pivotIndex which is essentially the fixed position of that element, we find other pivotIndex by recusirvely calling this function. @@ -12,40 +13,44 @@ title: Implement Quick Sort - It's an **unstable** algorithm. - ![Quick sort in action](https://upload.wikimedia.org/wikipedia/commons/6/6a/Sorting_quicksort_anim.gif) -### Solution: + +--- +## Solutions +
Solution 1 (Click to Show/Hide) + ```js -//Swapping array elements via ES6 array destructuring -function swap(arr, x, y){ +//Swapping array elements via ES6 array destructuring +function swap(arr, x, y) { [arr[x], arr[y]] = [arr[y], arr[x]]; } //Pivot function returns the fixed pivot point -function pivot(arr, left = 0, right = arr.length-1){ +function pivot(arr, left = 0, right = arr.length - 1) { let shift = left; - for (let i = left+1; i <= right; i++){ - + for (let i = left + 1; i <= right; i++) { //Move all the small elements on the left side if (arr[i] < arr[left]) swap(arr, i, ++shift); } - + //Finally swapping the last element with the left swap(arr, left, shift); return shift; } -function quickSort(array, left = 0, right = array.length-1) { - if (left < right){ +function quickSort(array, left = 0, right = array.length - 1) { + if (left < right) { let pivotIndex = pivot(array, left, right); - + //Recusrively calling the function to the left of the pivot and to the right of the pivot - quickSort(array, left, pivotIndex-1); - quickSort(array, pivotIndex+1, right); + quickSort(array, left, pivotIndex - 1); + quickSort(array, pivotIndex + 1, right); } return array; } ``` -### Reference: +#### Relevant Links - [Wikipedia](https://en.wikipedia.org/wiki/Quicksort) - [Khan Academy](https://www.khanacademy.org/computing/computer-science/algorithms/quick-sort/a/overview-of-quicksort) +
diff --git a/guide/english/certifications/coding-interview-prep/algorithms/implement-selection-sort/index.md b/guide/english/certifications/coding-interview-prep/algorithms/implement-selection-sort/index.md index 0c145e6658..5c08be031e 100644 --- a/guide/english/certifications/coding-interview-prep/algorithms/implement-selection-sort/index.md +++ b/guide/english/certifications/coding-interview-prep/algorithms/implement-selection-sort/index.md @@ -1,9 +1,10 @@ --- title: Implement Selection Sort --- -## Implement Selection Sort +# Implement Selection Sort -### Method: +--- +## Problem Explanation - Selection Sort is one of the easier sorting algorithm to understand and implement. - This algorithm splits the array in two parts: 1. Sorted @@ -12,17 +13,21 @@ title: Implement Selection Sort - Each pass, initially we assume the first element to be the smallest then we loop through the whole array and *select* the smallest element. At the end of the pass we swap smallest element to the sorted array. - It has **O(n2)** time complexity. -### Solution: + +--- +## Solutions +
Solution 1 (Click to Show/Hide) + ```js -function swap(a, b, arr){ +function swap(a, b, arr) { let tmp = arr[a]; arr[a] = arr[b]; arr[b] = tmp; } function selectionSort(array) { - for (let i = 0; i < array.length-1; i++){ + for (let i = 0; i < array.length - 1; i++) { let min = i; - for (let j = i+1; j < array.length; j++){ + for (let j = i + 1; j < array.length; j++) { if (array[min] > array[j]) min = j; } swap(i, min, array); @@ -31,6 +36,8 @@ function selectionSort(array) { } ``` -### References: +#### Relevant Links - Read about Selection Sort at [Wikipedia](https://en.wikipedia.org/wiki/Selection_sort) + +
\ No newline at end of file diff --git a/guide/english/certifications/coding-interview-prep/algorithms/index.md b/guide/english/certifications/coding-interview-prep/algorithms/index.md index 7ebe900e89..78e1a4d5ba 100644 --- a/guide/english/certifications/coding-interview-prep/algorithms/index.md +++ b/guide/english/certifications/coding-interview-prep/algorithms/index.md @@ -1,7 +1,7 @@ --- title: Algorithms --- -## Algorithms +# Algorithms This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/algorithms/inventory-update/index.md b/guide/english/certifications/coding-interview-prep/algorithms/inventory-update/index.md index a344bc86c5..2ead289028 100644 --- a/guide/english/certifications/coding-interview-prep/algorithms/inventory-update/index.md +++ b/guide/english/certifications/coding-interview-prep/algorithms/inventory-update/index.md @@ -1,9 +1,11 @@ --- title: Inventory Update --- -![:triangular_flag_on_post:](https://forum.freecodecamp.com/images/emoji/emoji_one/triangular_flag_on_post.png?v=3 ":triangular_flag_on_post:") Remember to use **`Read-Search-Ask`** if you get stuck. Try to pair program ![:busts_in_silhouette:](https://forum.freecodecamp.com/images/emoji/emoji_one/busts_in_silhouette.png?v=3 ":busts_in_silhouette:") and write your own code ![:pencil:](https://forum.freecodecamp.com/images/emoji/emoji_one/pencil.png?v=3 ":pencil:") -### ![:checkered_flag:](https://forum.freecodecamp.com/images/emoji/emoji_one/checkered_flag.png?v=3 ":checkered_flag:") Problem Explanation: +# Inventory Update + +--- +## Problem Explanation In this problem, you've to compare and update the inventory stored in a 2D array against a second 2D array of a fresh delivery. Update the current existing inventory item quantities (in `arr1`). If an item cannot be found, add the new item and quantity into the inventory array. The returned inventory array should be in alphabetical order by item. @@ -13,100 +15,92 @@ The current as well as new inventory will be in this format: `[[2, "item-0"], [3 * JS Array -## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ":speech_balloon:") Hint: 1 + +--- +## Hints + +### Hint 1 You need to work through each item of the new inventory to see if it exists in the current inventory or not. Remember that the product name is stored as the second element of each sub-array: `array[0][1] = "item-name"`. -> _try to solve the problem now_ -## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ":speech_balloon:") Hint: 2 +### Hint 2 If the item exists, you need to add the quantity from the new inventory. If the item doesn't exist, you need to add the entire item. -> _try to solve the problem now_ -## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ":speech_balloon:") Hint: 3 +### Hint 3 Return the completed inventory in alphabetical order. -> _try to solve the problem now_ -## Spoiler Alert! - -![warning sign](//discourse-user-assets.s3.amazonaws.com/original/2X/2/2d6c412a50797771301e7ceabd554cef4edcd74d.gif) - -**Solution ahead!** - -## ![:beginner:](https://forum.freecodecamp.com/images/emoji/emoji_one/beginner.png?v=3 ":beginner:") Basic Code Solution: +
Solution 1 (Click to Show/Hide) ```javascript - function updateInventory(arr1, arr2) { +function updateInventory(arr1, arr2) { + // Variable for location of product + var index; - // Variable for location of product - var index; - - // A helper method to return the index of a specified product (undefined if not found) - var getProductIndex = function (name) { - for (var i = 0; i < this.length; i++) { - if (this[i][1] === name) { - return i; - } - } - return undefined; - } - - // For each item of the new Inventory - for (var i = 0; i < arr2.length; i++) { - - // Invoke our helper function using arr1 as this - index = getProductIndex.call(arr1, arr2[i][1]); - - // If the item doesn't exist - if (index === undefined) { - // Push the entire item - arr1.push(arr2[i]); - } else { - // Add the new quantity of the current item - arr1[index][0] += arr2[i][0]; - } - - } - - // Sort alphabetically, by the product name of each item - arr1.sort(function (a, b) { - if (a[1] > b[1]) { - return 1; - } - if (a[1] < b[1]) { - return -1; - } - return 0; - }); - - return arr1; + // A helper method to return the index of a specified product (undefined if not found) + var getProductIndex = function(name) { + for (var i = 0; i < this.length; i++) { + if (this[i][1] === name) { + return i; + } } + return undefined; + }; - // test here - // Example inventory lists - var curInv = [ - [21, "Bowling Ball"], - [2, "Dirty Sock"], - [1, "Hair Pin"], - [5, "Microphone"] - ]; + // For each item of the new Inventory + for (var i = 0; i < arr2.length; i++) { + // Invoke our helper function using arr1 as this + index = getProductIndex.call(arr1, arr2[i][1]); - var newInv = [ - [2, "Hair Pin"], - [3, "Half-Eaten Apple"], - [67, "Bowling Ball"], - [7, "Toothpaste"] - ]; + // If the item doesn't exist + if (index === undefined) { + // Push the entire item + arr1.push(arr2[i]); + } else { + // Add the new quantity of the current item + arr1[index][0] += arr2[i][0]; + } + } - updateInventory(curInv, newInv); + // Sort alphabetically, by the product name of each item + arr1.sort(function(a, b) { + if (a[1] > b[1]) { + return 1; + } + if (a[1] < b[1]) { + return -1; + } + return 0; + }); + + return arr1; +} + +// test here +// Example inventory lists +var curInv = [ + [21, "Bowling Ball"], + [2, "Dirty Sock"], + [1, "Hair Pin"], + [5, "Microphone"] +]; + +var newInv = [ + [2, "Hair Pin"], + [3, "Half-Eaten Apple"], + [67, "Bowling Ball"], + [7, "Toothpaste"] +]; + +updateInventory(curInv, newInv); ``` -### Code Explanation: +#### Code Explanation * The variable **index** stores the location (index) of a product. * The helper function `getProductIndex()` returns the index of a specified product. It iterates through each element of the array that it is called on until it can find the name parameter. If the product is not found in the inventory, `undefined` is returned. @@ -124,74 +118,75 @@ Return the completed inventory in alphabetical order. * JS Array.prototype.push() * JS Array.prototype.sort() -## ![:sunflower:](https://forum.freecodecamp.com/images/emoji/emoji_one/sunflower.png?v=3 ":sunflower:") Intermediate Code Solution: +
+
Solution 2 (Click to Show/Hide) + ```javascript - function updateInventory(arr1, arr2) { - // All inventory must be accounted for or you're fired! +function updateInventory(arr1, arr2) { + // All inventory must be accounted for or you're fired! - var index; - var arrCurInvName = []; // Names of arr1's items - var arrNeInvName = []; // Names of arr2's items + var index; + var arrCurInvName = []; // Names of arr1's items + var arrNeInvName = []; // Names of arr2's items - // Same as using two for loops, this takes care of increasing the number of stock quantity. - arr1.map(function(item1) { - return arr2.map(function(item2) { - if (item1[1] === item2[1]) { - item1[0] = item1[0] + item2[0]; //Increase number of stock - } - }); - }); + // Same as using two for loops, this takes care of increasing the number of stock quantity. + arr1.map(function(item1) { + return arr2.map(function(item2) { + if (item1[1] === item2[1]) { + item1[0] = item1[0] + item2[0]; //Increase number of stock + } + }); + }); - // Get item's name for new Inventory - arr2.map(function(item) { - arrNeInvName.push(item[1]); - }); + // Get item's name for new Inventory + arr2.map(function(item) { + arrNeInvName.push(item[1]); + }); - // Get item's name for Current Inventory - arr1.map(function(item) { - arrCurInvName.push(item[1]); - }); + // Get item's name for Current Inventory + arr1.map(function(item) { + arrCurInvName.push(item[1]); + }); - // Add new inventory items to current inventory. - arrNeInvName.map(function(item) { - if (arrCurInvName.indexOf(item) === -1) { - index = arrNeInvName.indexOf(item); - arr1.push(arr2[index]); - } - }); - - // Sort the array alphabetically using the second element of the array as base. - arr1.sort(function(currItem, nextItem) { - - //Ternary function to avoid using if else - return currItem[1] > nextItem[1] ? 1 : -1; - }); - - return arr1; + // Add new inventory items to current inventory. + arrNeInvName.map(function(item) { + if (arrCurInvName.indexOf(item) === -1) { + index = arrNeInvName.indexOf(item); + arr1.push(arr2[index]); } + }); - // test here - // Example inventory lists - var curInv = [ - [21, "Bowling Ball"], - [2, "Dirty Sock"], - [1, "Hair Pin"], - [5, "Microphone"] - ]; + // Sort the array alphabetically using the second element of the array as base. + arr1.sort(function(currItem, nextItem) { + //Ternary function to avoid using if else + return currItem[1] > nextItem[1] ? 1 : -1; + }); - var newInv = [ - [2, "Hair Pin"], - [3, "Half-Eaten Apple"], - [67, "Bowling Ball"], - [7, "Toothpaste"] - ]; + return arr1; +} - updateInventory(curInv, newInv); +// test here +// Example inventory lists +var curInv = [ + [21, "Bowling Ball"], + [2, "Dirty Sock"], + [1, "Hair Pin"], + [5, "Microphone"] +]; + +var newInv = [ + [2, "Hair Pin"], + [3, "Half-Eaten Apple"], + [67, "Bowling Ball"], + [7, "Toothpaste"] +]; + +updateInventory(curInv, newInv); ``` -### Code Explanation: +#### Code Explanation * The variable **index** stores the location (index) of a product. * **arrCurInvName** has the names of **arr1**'s items. @@ -207,66 +202,64 @@ Return the completed inventory in alphabetical order. * JS Array.prototype.indexOf() * JS Ternary Operator -## ![:rotating_light:](https://forum.freecodecamp.com/images/emoji/emoji_one/rotating_light.png?v=3 ":rotating_light:") Advanced Code Solution: +
+ +
Solution 3 (Click to Show/Hide) ```javascript - function updateInventory(arr1, arr2) { - // All inventory must be accounted for or you're fired! +function updateInventory(arr1, arr2) { + // All inventory must be accounted for or you're fired! - // convert current inventory (arr1) to an one-dimensional array - const inventory = Array.prototype.concat.apply([], arr1); + // convert current inventory (arr1) to an one-dimensional array + const inventory = Array.prototype.concat.apply([], arr1); - // loop through new delivery (arr2) - for (let i = 0; i < arr2.length; i++) { + // loop through new delivery (arr2) + for (let i = 0; i < arr2.length; i++) { + // extract item properties for easy reference + const item = arr2[i][1]; + const quantity = arr2[i][0]; - // extract item properties for easy reference - const item = arr2[i][1]; - const quantity = arr2[i][0]; - - // check if item already exists in inventory - const position = inventory.indexOf(item); - - // exsisting item: update quantity - if (position !== -1) { - const row = Math.floor(position / 2); - arr1[row][0] += quantity; - continue; - } - - // alien item: add to inventory - arr1.push([quantity, item]); - - } - - // sort inventory in alphabetical order - arr1.sort((previous, next) => (previous[1] > [next[1]]) ? 1 : -1); - - return arr1; + // check if item already exists in inventory + const position = inventory.indexOf(item); + // exsisting item: update quantity + if (position !== -1) { + const row = Math.floor(position / 2); + arr1[row][0] += quantity; + continue; } + // alien item: add to inventory + arr1.push([quantity, item]); + } - // test here - // Example inventory lists - var curInv = [ - [21, "Bowling Ball"], - [2, "Dirty Sock"], - [1, "Hair Pin"], - [5, "Microphone"] - ]; + // sort inventory in alphabetical order + arr1.sort((previous, next) => (previous[1] > [next[1]] ? 1 : -1)); - var newInv = [ - [2, "Hair Pin"], - [3, "Half-Eaten Apple"], - [67, "Bowling Ball"], - [7, "Toothpaste"] - ]; + return arr1; +} - updateInventory(curInv, newInv); +// test here +// Example inventory lists +var curInv = [ + [21, "Bowling Ball"], + [2, "Dirty Sock"], + [1, "Hair Pin"], + [5, "Microphone"] +]; + +var newInv = [ + [2, "Hair Pin"], + [3, "Half-Eaten Apple"], + [67, "Bowling Ball"], + [7, "Toothpaste"] +]; + +updateInventory(curInv, newInv); ``` -### Code Explanation: +#### Code Explanation * Convert current inventory array **arr1** to an one-dimensional array in order that `indexOf()` method could be used to check existance of new delivery items in current inventory. * Check if item already exists in current inventory using `indexOf()`. @@ -279,9 +272,5 @@ Return the completed inventory in alphabetical order. * JS Function.prototype.apply() * JS continue * JS Array.prototype.sort() +
-## ![:clipboard:](https://forum.freecodecamp.com/images/emoji/emoji_one/clipboard.png?v=3 ":clipboard:") NOTES FOR CONTRIBUTIONS: - -* ![:warning:](https://forum.freecodecamp.com/images/emoji/emoji_one/warning.png?v=3 ":warning:") **DO NOT** add solutions that are similar to any existing solutions. If you think it is **_similar but better_**, then try to merge (or replace) the existing similar solution. -* Add an explanation of your solution. -* Categorize the solution in one of the following categories — **Basic**, **Intermediate** and **Advanced**. ![:traffic_light:](https://forum.freecodecamp.com/images/emoji/emoji_one/traffic_light.png?v=3 ":traffic_light:") diff --git a/guide/english/certifications/coding-interview-prep/algorithms/no-repeats-please/index.md b/guide/english/certifications/coding-interview-prep/algorithms/no-repeats-please/index.md index 2333677cda..8686b44a02 100644 --- a/guide/english/certifications/coding-interview-prep/algorithms/no-repeats-please/index.md +++ b/guide/english/certifications/coding-interview-prep/algorithms/no-repeats-please/index.md @@ -1,17 +1,19 @@ --- title: No Repeats Please --- -![:triangular_flag_on_post:](https://forum.freecodecamp.com/images/emoji/emoji_one/triangular_flag_on_post.png?v=3 ":triangular_flag_on_post:") Remember to use **`Read-Search-Ask`** if you get stuck. Try to pair program ![:busts_in_silhouette:](https://forum.freecodecamp.com/images/emoji/emoji_one/busts_in_silhouette.png?v=3 ":busts_in_silhouette:") and write your own code ![:pencil:](https://forum.freecodecamp.com/images/emoji/emoji_one/pencil.png?v=3 ":pencil:") -### ![:checkered_flag:](https://forum.freecodecamp.com/images/emoji/emoji_one/checkered_flag.png?v=3 ":checkered_flag:") Problem Explanation: +# No Repeats Please + +--- +## Problem Explanation This task requires us to return the number of total permutations of the provided string that don't have repeated consecutive letters. It is to be assumed that all characters in the provided string are each unique. For example, `aab` should return 2 because it has 6 total permutations (`aab`, `aab`, `aba`, `aba`, `baa`, `baa`), but only 2 of them (`aba` and `aba`) don't have the same letter (in this case `a`) repeating. To achieve that, we'll have to look at each possible permutation of a string. There are several ways to do that. A common interview question is building a function that collects all permutations of a string. There are several tutorials available on the internet on how to do that. -#### Potential Methods Used As Solution +**Potential Methods Used As Solution** -##### Recursive Method +**Recursive Method** This task can be daunting even after watching a tutorial. To write a recursive solution, you will want to send each new use of the function three inputs: @@ -21,6 +23,7 @@ This task can be daunting even after watching a tutorial. To write a recursive s The pseudo code will look something like this: +``` var str = ???; permAlone(current position in original string, characters used already in original string, created string) { if (current string is finished) { @@ -37,13 +40,15 @@ The pseudo code will look something like this: } } permAlone(0, nothing used yet, empty new string (or array the same size as str)); +``` Another way to think about this problem is to start from an empty space. Introduce the first letter to the space. This space will now contain the first sub-permutation. Here's a diagram illustrating the idea: ![diagram](//discourse-user-assets.s3.amazonaws.com/original/2X/6/69896bacc8bd3b2e347beb4b304a7f97caa6d9ab.png) -##### Non-Recursive Method +**Non-Recursive Method** +``` // An approach to introduce a new character to a permutation var ch = '?'; var source = ['?', '?', '?']; // Current sub-permutation @@ -54,6 +59,7 @@ Another way to think about this problem is to start from an empty space. Introdu temp.splice(i, 0, ch); // Insert the new character dest.push(temp); // Store the new sub-permutation } +``` Finding each permutation could then be done non-recursively by including the above in a function taking a source array and returning a destination array. For each letter of the input string, pass that character, as well as the array returned from the previous call of the function. @@ -68,81 +74,76 @@ A way to visualize this is by considering a tree that starts with the first char * JS Regex Resources * JS String object -## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ":speech_balloon:") Hint: 1 + +--- +## Hints + +### Hint 1 * The easiest way is to use Heap's algorithm to recursively get a list of all the permutations. -> _try to solve the problem now_ -## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ":speech_balloon:") Hint: 2 +### Hint 2 * Once you have the list then just create a regular expression to catch the repeating characters. -> _try to solve the problem now_ -## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ":speech_balloon:") Hint: 3 +### Hint 3 * You will want to have the permutations as an array of joined strings instead of separated characters. -> _try to solve the problem now_ -## Spoiler Alert! +
Solution 1 (Click to Show/Hide) -![warning sign](//discourse-user-assets.s3.amazonaws.com/original/2X/2/2d6c412a50797771301e7ceabd554cef4edcd74d.gif) +```js +function permAlone(str) { + // Create a regex to match repeated consecutive characters. + var regex = /(.)\1+/; -**Solution ahead!** + // Split the string into an array of characters. + var arr = str.split(""); + var permutations = []; + var tmp; -## ![:beginner:](https://forum.freecodecamp.com/images/emoji/emoji_one/beginner.png?v=3 ":beginner:") Basic Code Solution: + // Return 0 if str contains same character. + if (str.match(regex) !== null && str.match(regex)[0] === str) return 0; - function permAlone(str) { + // Function to swap variables' content. + function swap(index1, index2) { + tmp = arr[index1]; + arr[index1] = arr[index2]; + arr[index2] = tmp; + } - // Create a regex to match repeated consecutive characters. - var regex = /(.)\1+/; - - // Split the string into an array of characters. - var arr = str.split(''); - var permutations = []; - var tmp; - - // Return 0 if str contains same character. - if (str.match(regex) !== null && str.match(regex)[0] === str) return 0; - - // Function to swap variables' content. - function swap(index1, index2) { - tmp = arr[index1]; - arr[index1] = arr[index2]; - arr[index2] = tmp; + // Generate arrays of permutations using the algorithm. + function generate(int) { + if (int === 1) { + // Make sure to join the characters as we create the permutation arrays + permutations.push(arr.join("")); + } else { + for (var i = 0; i != int; ++i) { + generate(int - 1); + swap(int % 2 ? 0 : i, int - 1); } - - // Generate arrays of permutations using the algorithm. - function generate(int) { - if (int === 1) { - // Make sure to join the characters as we create the permutation arrays - permutations.push(arr.join('')); - } else { - for (var i = 0; i != int; ++i) { - generate(int - 1); - swap(int % 2 ? 0 : i, int - 1); - } - } - } - - generate(arr.length); - - // Filter the array of repeated permutations. - var filtered = permutations.filter(function(string) { - return !string.match(regex); - }); - - // Return how many have no repetitions. - return filtered.length; } + } - // Test here. - permAlone('aab'); + generate(arr.length); + // Filter the array of repeated permutations. + var filtered = permutations.filter(function(string) { + return !string.match(regex); + }); -### Code Explanation: + // Return how many have no repetitions. + return filtered.length; +} + +// Test here. +permAlone("aab"); +``` + +#### Code Explanation * **regex** contains the regular expression to match repeated consecutive characters. * The string **str** is split into an array of characters, **arr**. @@ -162,8 +163,5 @@ A way to visualize this is by considering a tree that starts with the first char * array.length * JS Array Prototype Filter -## ![:clipboard:](https://forum.freecodecamp.com/images/emoji/emoji_one/clipboard.png?v=3 ":clipboard:") NOTES FOR CONTRIBUTIONS: -* ![:warning:](https://forum.freecodecamp.com/images/emoji/emoji_one/warning.png?v=3 ":warning:") **DO NOT** add solutions that are similar to any existing solutions. If you think it is **_similar but better_**, then try to merge (or replace) the existing similar solution. -* Add an explanation of your solution. -* Categorize the solution in one of the following categories — **Basic**, **Intermediate** and **Advanced**. ![:traffic_light:](https://forum.freecodecamp.com/images/emoji/emoji_one/traffic_light.png?v=3 ":traffic_light:") +
\ No newline at end of file diff --git a/guide/english/certifications/coding-interview-prep/algorithms/pairwise/index.md b/guide/english/certifications/coding-interview-prep/algorithms/pairwise/index.md index 33dc315160..e907d22b35 100644 --- a/guide/english/certifications/coding-interview-prep/algorithms/pairwise/index.md +++ b/guide/english/certifications/coding-interview-prep/algorithms/pairwise/index.md @@ -1,7 +1,7 @@ --- title: Pairwise --- -## Pairwise +# Pairwise This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/add-a-new-element-to-a-binary-search-tree/index.md b/guide/english/certifications/coding-interview-prep/data-structures/add-a-new-element-to-a-binary-search-tree/index.md index 1962c9daf4..fba53a43c7 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/add-a-new-element-to-a-binary-search-tree/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/add-a-new-element-to-a-binary-search-tree/index.md @@ -1,7 +1,7 @@ --- title: Add a New Element to a Binary Search Tree --- -## Add a New Element to a Binary Search Tree +# Add a New Element to a Binary Search Tree This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/add-elements-at-a-specific-index-in-a-linked-list/index.md b/guide/english/certifications/coding-interview-prep/data-structures/add-elements-at-a-specific-index-in-a-linked-list/index.md index f241d33589..986751313f 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/add-elements-at-a-specific-index-in-a-linked-list/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/add-elements-at-a-specific-index-in-a-linked-list/index.md @@ -1,7 +1,7 @@ --- title: Add Elements at a Specific Index in a Linked List --- -## Add Elements at a Specific Index in a Linked List +# Add Elements at a Specific Index in a Linked List This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/adjacency-list/index.md b/guide/english/certifications/coding-interview-prep/data-structures/adjacency-list/index.md index d623cd0014..149face0d7 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/adjacency-list/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/adjacency-list/index.md @@ -1,50 +1,44 @@ --- title: Adjacency List --- -## Adjacency List -![:triangular_flag_on_post:](https://forum.freecodecamp.com/images/emoji/emoji_one/triangular_flag_on_post.png?v=3 ":triangular_flag_on_post:") Remember to use **`Read-Search-Ask`** if you get stuck. Try to pair program ![:busts_in_silhouette:](https://forum.freecodecamp.com/images/emoji/emoji_one/busts_in_silhouette.png?v=3 ":busts_in_silhouette:") and write your own code ![:pencil:](https://forum.freecodecamp.com/images/emoji/emoji_one/pencil.png?v=3 ":pencil:") +# Adjacency List -### ![:checkered_flag:](https://forum.freecodecamp.com/images/emoji/emoji_one/checkered_flag.png?v=3 ":checkered_flag:") Problem Explanation: +--- +## Problem Explanation To solve this problem, you have to create a Javascript Object to emulate an undirected graph in the form of an adjacency list. -## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ":speech_balloon:") Hint: 1 +--- +## Hints + +### Hint 1 Create keys with the names James, Jill, Jenny and Jeff. -> _try to solve the problem now_ -## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ":speech_balloon:") Hint: 2 +### Hint 2 Read the presentation and try to understand what it means to be an undirected graph. -> _try to solve the problem now_ + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) + +```js +var undirectedAdjList = { + James: ["Jeff"], + Jill: ["Jenny"], + Jenny: ["Jill", "Jeff"], + Jeff: ["Jenny", "James"] +}; +``` - -## Spoiler Alert! - -![warning sign](//discourse-user-assets.s3.amazonaws.com/original/2X/2/2d6c412a50797771301e7ceabd554cef4edcd74d.gif) - -**Solution ahead!** - -## ![:beginner:](https://forum.freecodecamp.com/images/emoji/emoji_one/beginner.png?v=3 ":beginner:") Basic Code Solution: - - var undirectedAdjList = { - James: ["Jeff"], - Jill: ["Jenny"], - Jenny: ["Jill", "Jeff"], - Jeff: ["Jenny", "James"] - }; - - -### Code Explanation: +#### Code Explanation * The undirected graph is created using a Javascript Object. Each unique name is a key and the each person who has a relationship with the name is in the unique name's array value. e.g. if James and Jeff have a relationship, Jeff will be in James's array value and James will be in Jeff's array value. -## ![:clipboard:](https://forum.freecodecamp.com/images/emoji/emoji_one/clipboard.png?v=3 ":clipboard:") NOTES FOR CONTRIBUTIONS: - -* ![:warning:](https://forum.freecodecamp.com/images/emoji/emoji_one/warning.png?v=3 ":warning:") **DO NOT** add solutions that are similar to any existing solutions. If you think it is **_similar but better_**, then try to merge (or replace) the existing similar solution. -* Add an explanation of your solution. -* Categorize the solution in one of the following categories — **Basic**, **Intermediate** and **Advanced**. ![:traffic_light:](https://forum.freecodecamp.com/images/emoji/emoji_one/traffic_light.png?v=3 ":traffic_light:") +
\ No newline at end of file diff --git a/guide/english/certifications/coding-interview-prep/data-structures/adjacency-matrix/index.md b/guide/english/certifications/coding-interview-prep/data-structures/adjacency-matrix/index.md index 0615021057..e3ac3efe67 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/adjacency-matrix/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/adjacency-matrix/index.md @@ -1,7 +1,7 @@ --- title: Adjacency Matrix --- -## Adjacency Matrix +# Adjacency Matrix This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/breadth-first-search/index.md b/guide/english/certifications/coding-interview-prep/data-structures/breadth-first-search/index.md index 8b30796d5f..9e201144fd 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/breadth-first-search/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/breadth-first-search/index.md @@ -1,56 +1,46 @@ --- title: Breadth-First Search --- -## Breadth-First Search +# Breadth-First Search -Let's first define the `Tree` class to be used for the implementation of the Breadth First Search algorithm. -```python -class Tree: - def __init__(self, x): - self.val = x - self.left = None - self.right = None +--- +## Solutions + +
Solution 1 (Click to Show/Hide) + +```js +function bfs(graph, root) { + // Distance object returned + var nodesLen = {}; + // Set all distances to infinity + for (var i = 0; i < graph.length; i++) { + nodesLen[i] = Infinity; + } + nodesLen[root] = 0; // ...except root node + var queue = [root]; // Keep track of nodes to visit + var current; // Current node traversing + // Keep on going until no more nodes to traverse + while (queue.length !== 0) { + current = queue.shift(); + // Get adjacent nodes from current node + var curConnected = graph[current]; // Get layer of edges from current + var neighborIdx = []; // List of nodes with edges + var idx = curConnected.indexOf(1); // Get first edge connection + while (idx !== -1) { + neighborIdx.push(idx); // Add to list of neighbors + idx = curConnected.indexOf(1, idx + 1); // Keep on searching + } + // Loop through neighbors and get lengths + for (var j = 0; j < neighborIdx.length; j++) { + // Increment distance for nodes traversed + if (nodesLen[neighborIdx[j]] === Infinity) { + nodesLen[neighborIdx[j]] = nodesLen[current] + 1; + queue.push(neighborIdx[j]); // Add new neighbors to queue + } + } + } + return nodesLen; +} ``` - -The breadth first search algorithm moves from one level to another starting from the root of the tree. We will make use of a `queue` for this. - -```python - -def bfs(root_node): - queue = [root_node] - - while queue: - top_element = queue.pop() - print("Node processed: ",top_element) - - if top_element.left: - queue.append(top_element.left) - - if top_element.right: - queue.append(top_element.right) -``` - -We can easily modify the above code to print the level of each node as well. - -```python - -def bfs(root_node): - queue = [(root_node, 0)] - - while queue: - top_element, level = queue.pop() - print("Node processed: {} at level {}".format(top_element, level)) - - if top_element.left: - queue.append((top_element.left, level + 1)) - - if top_element.right: - queue.append((top_element.right, level + 1)) -``` - - -| Complexity | Time | Space | -| ----- | ------ | ------ | -| BFS | n | n | - +
\ No newline at end of file diff --git a/guide/english/certifications/coding-interview-prep/data-structures/check-if-an-element-is-present-in-a-binary-search-tree/index.md b/guide/english/certifications/coding-interview-prep/data-structures/check-if-an-element-is-present-in-a-binary-search-tree/index.md index 35ac2f6572..81c4d1f9f8 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/check-if-an-element-is-present-in-a-binary-search-tree/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/check-if-an-element-is-present-in-a-binary-search-tree/index.md @@ -1,7 +1,7 @@ --- title: Check if an Element is Present in a Binary Search Tree --- -## Check if an Element is Present in a Binary Search Tree +# Check if an Element is Present in a Binary Search Tree This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/create-a-circular-queue/index.md b/guide/english/certifications/coding-interview-prep/data-structures/create-a-circular-queue/index.md index 28e63b9eb7..6d6c757d7b 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/create-a-circular-queue/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/create-a-circular-queue/index.md @@ -1,81 +1,88 @@ --- title: Create a Circular Queue --- -## Create a Circular Queue +# Create a Circular Queue -### Method: +--- +## Problem Explanation - In this challenge we create a Circular Queue data structure. - First, we need to create an array of `size` with all elements set to `null`. - Then we create an equeue method, which moves the write pointer but doesnt exceed the read pointer. - The dequeue method on the other hand, moves the read pointer but doesnt exceed the write pointer. - Example: + - First, we create an array of length 5: - ```shell +``` [null, null, null, null, null] ^Read @ 0 ^Write @ 0 - ``` - - Then we enqueue `a`, `b`, and `c`: - ```shell +``` + - Then we enqueue `a`, `b`, and `c`: +``` [a, b, c, null, null] ^Read @ 0 ^Write @ 3 - ``` +``` - Now we dequeue all the enqueued items: - ```shell + +``` [null, null, null, null, null] ^Read @ 3 ^Write @ 3 - ``` +``` - Finally, we enqueue `d`, `e` and `f`: - ```shell +``` [f, null, null, d, e] ^Read @ 3 ^Write @ 1 - ``` -### Solution: +``` + + +--- +## Solutions +
Solution 1 (Click to Show/Hide) + ```js class CircularQueue { - constructor(size) { - - this.queue = []; - this.read = 0; - this.write = 0; - this.max = size - 1; - - while (size > 0) { - this.queue.push(null); - size--; - } - + constructor(size) { + this.queue = []; + this.read = 0; + this.write = 0; + this.max = size - 1; + + while (size > 0) { + this.queue.push(null); + size--; } - - print() { - return this.queue; + } + + print() { + return this.queue; + } + + enqueue(item) { + if (this.queue[this.write] === null) { + this.queue[this.write++] = item; + + if (this.write > this.max) this.write = 0; + return item; } - - - enqueue(item) { - if (this.queue[this.write] === null){ - this.queue[this.write++] = item; - - if (this.write > this.max) this.write = 0; - return item; - } - return null; + return null; + } + + dequeue() { + if (this.queue[this.read] != null) { + let item = this.queue[this.read]; + this.queue[this.read++] = null; + if (this.read > this.max) this.read = 0; + return item; } - - dequeue() { - if (this.queue[this.read] != null){ - let item = this.queue[this.read]; - this.queue[this.read++] = null; - if (this.read > this.max) this.read = 0; - return item; - } - return null; - } - } - ``` -### References: + return null; + } +} +``` +#### Relevant Links - [Wikipedia](https://en.wikipedia.org/wiki/Circular_buffer) + +
\ No newline at end of file diff --git a/guide/english/certifications/coding-interview-prep/data-structures/create-a-doubly-linked-list/index.md b/guide/english/certifications/coding-interview-prep/data-structures/create-a-doubly-linked-list/index.md index 1c55699a7c..c59bbd7dda 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/create-a-doubly-linked-list/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/create-a-doubly-linked-list/index.md @@ -1,7 +1,7 @@ --- title: Create a Doubly Linked List --- -## Create a Doubly Linked List +# Create a Doubly Linked List This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/create-a-hash-table/index.md b/guide/english/certifications/coding-interview-prep/data-structures/create-a-hash-table/index.md index 15f5de3db0..e610999d6d 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/create-a-hash-table/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/create-a-hash-table/index.md @@ -1,7 +1,7 @@ --- title: Create a Hash Table --- -## Create a Hash Table +# Create a Hash Table This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/create-a-linked-list-class/index.md b/guide/english/certifications/coding-interview-prep/data-structures/create-a-linked-list-class/index.md index d6eef7f810..e4bf428df8 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/create-a-linked-list-class/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/create-a-linked-list-class/index.md @@ -1,7 +1,7 @@ --- title: Create a Linked List Class --- -## Create a Linked List Class +# Create a Linked List Class This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/create-a-map-data-structure/index.md b/guide/english/certifications/coding-interview-prep/data-structures/create-a-map-data-structure/index.md index 01602310fe..e63c2daa21 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/create-a-map-data-structure/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/create-a-map-data-structure/index.md @@ -1,7 +1,7 @@ --- title: Create a Map Data Structure --- -## Create a Map Data Structure +# Create a Map Data Structure This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/create-a-priority-queue-class/index.md b/guide/english/certifications/coding-interview-prep/data-structures/create-a-priority-queue-class/index.md index 0e3537f681..3122dd0234 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/create-a-priority-queue-class/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/create-a-priority-queue-class/index.md @@ -1,9 +1,10 @@ --- title: Create a Priority Queue Class --- -## Create a Priority Queue Class +# Create a Priority Queue Class -### Method: +--- +## Problem Explanation - Priority Queue is an Abstract Data Type. - It can be implemented using other Data Structures but is commonly implemented using a Heap. - Each node contains a priority. When we enqueue a node to the queue, it's "bubbled up" to its place in the queue. @@ -18,7 +19,11 @@ title: Create a Priority Queue Class | Priority Queue | 1 | 1 | logn | logn | -### Solution: + +--- +## Solutions +
Solution 1 (Click to Show/Hide) + ```js //function which swaps elements in array, using ES6 syntax function swap(arr, i, j) { @@ -121,5 +126,7 @@ class PriorityQueue { } ``` -### References: +#### Relevant Links - [Wikipedia](https://en.wikipedia.org/wiki/Priority_queue) + +
\ No newline at end of file diff --git a/guide/english/certifications/coding-interview-prep/data-structures/create-a-queue-class/index.md b/guide/english/certifications/coding-interview-prep/data-structures/create-a-queue-class/index.md index 703918a9d2..b5e8edeee6 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/create-a-queue-class/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/create-a-queue-class/index.md @@ -1,10 +1,11 @@ --- title: Create a Queue Class --- -## Create a Queue Class +# Create a Queue Class -### Method: +--- +## Problem Explanation - A Queue is an abstract Data Structure. - A Queue folow FIFO/LILO principle. - In this challenge we nede to implement `enqueue()`, `dequeue()`, `front()`, `size()`, `isEmpty()` methods. @@ -20,61 +21,69 @@ title: Create a Queue Class - ![Queue in action](https://upload.wikimedia.org/wikipedia/commons/thumb/5/52/Data_Queue.svg/405px-Data_Queue.svg.png) -### Solution: -#### Basic: -##### Note: -- This solution is not exactly a queue, the shift() method used in the dequeue() method is of complexity `O(n)` and not `O(1)`. However, the advanced solution rectifies this and uses Object(HashTables) instead of Array to implement Queue. +--- +## Solutions + +
Solution 1 (Click to Show/Hide) + +**Note:** This solution is not exactly a queue, the shift() method used in the dequeue() method is of complexity `O(n)` and not `O(1)`. However, the advanced solution rectifies this and uses Object(HashTables) instead of Array to implement Queue. + ```js -function Queue () { - var collection = []; - this.print = function() { - console.log(collection); - }; - this.enqueue = function(val){ - collection.push(val); - }; - this.dequeue = function(){ - return collection.shift(); - } - this.front = function(){ - return collection[0]; - } - this.size = function(){ - return collection.length; - } - this.isEmpty = function(){ - return collection.length === 0; - } +function Queue() { + var collection = []; + this.print = function() { + console.log(collection); + }; + this.enqueue = function(val) { + collection.push(val); + }; + this.dequeue = function() { + return collection.shift(); + }; + this.front = function() { + return collection[0]; + }; + this.size = function() { + return collection.length; + }; + this.isEmpty = function() { + return collection.length === 0; + }; } ``` -#### Advanced - ES6 class syntax: +
+ + +
Solution 2 (Click to Show/Hide) + ```js class Queue { - constructor(){ - this.collection = {}; - this.start = 0; - this.end = 0; - } - print(){ - console.log(this.collection); - } - enqueue(val){ - this.collection[this.end++] = val; - } - dequeue(){ - return this.collection[this.start++]; - } - front(){ - return this.collection[this.start]; - } - size(){ - return this.end - this.start; - } - isEmpty(){ - return this.size() === 0; - } + constructor() { + this.collection = {}; + this.start = 0; + this.end = 0; + } + print() { + console.log(this.collection); + } + enqueue(val) { + this.collection[this.end++] = val; + } + dequeue() { + return this.collection[this.start++]; + } + front() { + return this.collection[this.start]; + } + size() { + return this.end - this.start; + } + isEmpty() { + return this.size() === 0; + } } ``` -### References: +#### Relevant Links - [Wikipedia](https://en.wikipedia.org/wiki/Queue_(abstract_data_type)) +
diff --git a/guide/english/certifications/coding-interview-prep/data-structures/create-a-set-class/index.md b/guide/english/certifications/coding-interview-prep/data-structures/create-a-set-class/index.md index 6d2da73dd2..58ce42144d 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/create-a-set-class/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/create-a-set-class/index.md @@ -1,32 +1,39 @@ --- title: Create a Set Class --- -## Create a Set Class +# Create a Set Class -### Method: +--- +## Problem Explanation - A Set is an abstract data structure. - It can store unique value and the collection is unordered. - In this challenge, we have to implement `.add()` method. This method should only add unique values to `collection`. - The method should return `true`, if the value is sucessfully added to the collection, otherwise it should return `false`. -### Solution: + +--- +## Solutions +
Solution 1 (Click to Show/Hide) + ```js function Set() { - // the var collection will hold our set - var collection = []; - // this method will check for the presence of an element and return true or false - this.has = function(element) { - return (collection.indexOf(element) !== -1); - }; - // this method will return all the values in the set - this.values = function() { - return collection; - }; - this.add = function(el) { - return this.has(el) ? false : Boolean(collection.push(el)); - } + // the var collection will hold our set + var collection = []; + // this method will check for the presence of an element and return true or false + this.has = function(element) { + return collection.indexOf(element) !== -1; + }; + // this method will return all the values in the set + this.values = function() { + return collection; + }; + this.add = function(el) { + return this.has(el) ? false : Boolean(collection.push(el)); + }; } ``` -### Resources: +#### Relevant Links - [Wikipedia](https://en.wikipedia.org/wiki/Set_(abstract_data_type)) + +
\ No newline at end of file diff --git a/guide/english/certifications/coding-interview-prep/data-structures/create-a-stack-class/index.md b/guide/english/certifications/coding-interview-prep/data-structures/create-a-stack-class/index.md index 6107ede6e6..2dce817e6c 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/create-a-stack-class/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/create-a-stack-class/index.md @@ -1,9 +1,10 @@ --- title: Create a Stack Class --- -## Create a Stack Class +# Create a Stack Class -### Method: +--- +## Problem Explanation - Stack is an abstract data structure. - Stack follows LIFO/FILO principle. - In this challenge, we need to add `.push()`, `.pop()`, `.peek()`, `.isEmpty()` and `.clear()` methods to the class. @@ -18,58 +19,65 @@ title: Create a Stack Class | ----- | ------ | ------ | ------ | ------ | | Stack | n | n | 1 | 1 | -### Solution: -#### Basic: -```js -function Stack() { - var collection = []; - this.print = function() { - console.log(collection); - }; - this.push = function(val){ - return collection.push(val); - } - this.pop = function(){ - return collection.pop(); - } - this.peek = function(){ - return collection[collection.length-1]; - } - this.isEmpty = function(){ - return collection.length === 0; - } - this.clear = function(){ - collection.length = 0; - } -} -``` -#### Advanced - ES6 Class syntax: -```js -class Stack { - constructor() { - this.collection = []; - } - print(){ - console.log(this.collection); - } - push(val){ - retiurn this.collection.push(val); - } - pop(){ - return this.collection.pop(); - } - peek(){ - return this.collection[this.collection.length-1]; - } - isEmpty(){ - return this.collection.length === 0; - } - clear(){ - return this.collection.length = 0; - } +--- +## Solutions + +
Solution 1 (Click to Show/Hide) + +```js +function Stack() { + var collection = []; + this.print = function() { + console.log(collection); + }; + this.push = function(val) { + return collection.push(val); + }; + this.pop = function() { + return collection.pop(); + }; + this.peek = function() { + return collection[collection.length - 1]; + }; + this.isEmpty = function() { + return collection.length === 0; + }; + this.clear = function() { + collection.length = 0; + }; } ``` - ### Resources: +
+ +
Solution 2 (Click to Show/Hide) + +```js +class Stack { + constructor() { + this.collection = []; + } + print() { + console.log(this.collection); + } + push(val) { + return this.collection.push(val); + } + pop() { + return this.collection.pop(); + } + peek() { + return this.collection[this.collection.length - 1]; + } + isEmpty() { + return this.collection.length === 0; + } + clear() { + return (this.collection.length = 0); + } +} +``` + #### Relevant Links - [Wikipedia](https://en.wikipedia.org/wiki/Stack_(abstract_data_type)) +
diff --git a/guide/english/certifications/coding-interview-prep/data-structures/create-a-trie-search-tree/index.md b/guide/english/certifications/coding-interview-prep/data-structures/create-a-trie-search-tree/index.md index d916a053d2..840115efff 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/create-a-trie-search-tree/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/create-a-trie-search-tree/index.md @@ -1,7 +1,7 @@ --- title: Create a Trie Search Tree --- -## Create a Trie Search Tree +# Create a Trie Search Tree This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/create-an-es6-javascript-map/index.md b/guide/english/certifications/coding-interview-prep/data-structures/create-an-es6-javascript-map/index.md index 55449849e6..27bedf91c2 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/create-an-es6-javascript-map/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/create-an-es6-javascript-map/index.md @@ -1,7 +1,7 @@ --- title: Create an ES6 JavaScript Map --- -## Create an ES6 JavaScript Map +# Create an ES6 JavaScript Map This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/create-and-add-to-sets-in-es6/index.md b/guide/english/certifications/coding-interview-prep/data-structures/create-and-add-to-sets-in-es6/index.md index 87fd84b383..df9cc1dddc 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/create-and-add-to-sets-in-es6/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/create-and-add-to-sets-in-es6/index.md @@ -1,37 +1,31 @@ --- title: Create and Add to Sets in ES6 --- -## Create and Add to Sets in ES6 +# Create and Add to Sets in ES6 - -![:triangular_flag_on_post:](https://forum.freecodecamp.com/images/emoji/emoji_one/triangular_flag_on_post.png?v=3 ":triangular_flag_on_post:") Remember to use **`Read-Search-Ask`** if you get stuck. Try to pair program ![:busts_in_silhouette:](https://forum.freecodecamp.com/images/emoji/emoji_one/busts_in_silhouette.png?v=3 ":busts_in_silhouette:") and write your own code ![:pencil:](https://forum.freecodecamp.com/images/emoji/emoji_one/pencil.png?v=3 ":pencil:") - -### ![:checkered_flag:](https://forum.freecodecamp.com/images/emoji/emoji_one/checkered_flag.png?v=3 ":checkered_flag:") Problem Explanation: +--- +## Problem Explanation To solve this problem, you have to add an array of items to the set. -## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ":speech_balloon:") Hint: 1 +--- +## Hints + +### Hint 1 Use the add function to add an array of strings to the set. -> _try to solve the problem now_ -## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ":speech_balloon:") Hint: 2 +### Hint 2 Use the length attribute on the values of the Set. -> _try to solve the problem now_ +--- +## Solutions - -## Spoiler Alert! - -![warning sign](//discourse-user-assets.s3.amazonaws.com/original/2X/2/2d6c412a50797771301e7ceabd554cef4edcd74d.gif) - -**Solution ahead!** - -## ![:beginner:](https://forum.freecodecamp.com/images/emoji/emoji_one/beginner.png?v=3 ":beginner:") Basic Code Solution: +
Solution 1 (Click to Show/Hide) ```js function checkSet() { @@ -46,13 +40,10 @@ function checkSet() { checkSet(); ``` -### Code Explanation: +#### Code Explanation * Creating a set object as shown in pre-written code will create the set without duplicate objects. * Therefore, by using the add function, we can add items to the set and they will not be duplicated, and will still be represented in the array. -## ![:clipboard:](https://forum.freecodecamp.com/images/emoji/emoji_one/clipboard.png?v=3 ":clipboard:") NOTES FOR CONTRIBUTIONS: -* ![:warning:](https://forum.freecodecamp.com/images/emoji/emoji_one/warning.png?v=3 ":warning:") **DO NOT** add solutions that are similar to any existing solutions. If you think it is **_similar but better_**, then try to merge (or replace) the existing similar solution. -* Add an explanation of your solution. -* Categorize the solution in one of the following categories — **Basic**, **Intermediate** and **Advanced**. ![:traffic_light:](https://forum.freecodecamp.com/images/emoji/emoji_one/traffic_light.png?v=3 ":traffic_light:") +
\ No newline at end of file diff --git a/guide/english/certifications/coding-interview-prep/data-structures/delete-a-leaf-node-in-a-binary-search-tree/index.md b/guide/english/certifications/coding-interview-prep/data-structures/delete-a-leaf-node-in-a-binary-search-tree/index.md index 6328da67c8..a68d8be11b 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/delete-a-leaf-node-in-a-binary-search-tree/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/delete-a-leaf-node-in-a-binary-search-tree/index.md @@ -1,7 +1,7 @@ --- title: Delete a Leaf Node in a Binary Search Tree --- -## Delete a Leaf Node in a Binary Search Tree +# Delete a Leaf Node in a Binary Search Tree This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/delete-a-node-with-one-child-in-a-binary-search-tree/index.md b/guide/english/certifications/coding-interview-prep/data-structures/delete-a-node-with-one-child-in-a-binary-search-tree/index.md index cc7b952141..98f8c5bc3d 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/delete-a-node-with-one-child-in-a-binary-search-tree/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/delete-a-node-with-one-child-in-a-binary-search-tree/index.md @@ -1,7 +1,7 @@ --- title: Delete a Node with One Child in a Binary Search Tree --- -## Delete a Node with One Child in a Binary Search Tree +# Delete a Node with One Child in a Binary Search Tree This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/delete-a-node-with-two-children-in-a-binary-search-tree/index.md b/guide/english/certifications/coding-interview-prep/data-structures/delete-a-node-with-two-children-in-a-binary-search-tree/index.md index f160e6647e..35a02d6a70 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/delete-a-node-with-two-children-in-a-binary-search-tree/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/delete-a-node-with-two-children-in-a-binary-search-tree/index.md @@ -1,7 +1,7 @@ --- title: Delete a Node with Two Children in a Binary Search Tree --- -## Delete a Node with Two Children in a Binary Search Tree +# Delete a Node with Two Children in a Binary Search Tree This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/depth-first-search/index.md b/guide/english/certifications/coding-interview-prep/data-structures/depth-first-search/index.md index f1e3badb6b..a66351c713 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/depth-first-search/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/depth-first-search/index.md @@ -1,7 +1,7 @@ --- title: Depth-First Search --- -## Depth-First Search +# Depth-First Search This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/find-the-minimum-and-maximum-height-of-a-binary-search-tree/index.md b/guide/english/certifications/coding-interview-prep/data-structures/find-the-minimum-and-maximum-height-of-a-binary-search-tree/index.md index 98ab37a7a2..17860ba790 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/find-the-minimum-and-maximum-height-of-a-binary-search-tree/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/find-the-minimum-and-maximum-height-of-a-binary-search-tree/index.md @@ -1,87 +1,88 @@ --- title: Find the Minimum and Maximum Height of a Binary Search Tree --- -## Find the Minimum and Maximum Height of a Binary Search Tree +# Find the Minimum and Maximum Height of a Binary Search Tree -### Solution + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) ```js -var displayTree = (tree) => console.log(JSON.stringify(tree, null, 2)); +var displayTree = tree => console.log(JSON.stringify(tree, null, 2)); function Node(value) { - this.value = value; - this.left = null; - this.right = null; + this.value = value; + this.left = null; + this.right = null; } function BinarySearchTree() { - this.root = null; - // change code below this line - // change code above this line - this.findMinHeight = function(root = this.root) { - // empty tree. - if(root === null) { - return -1; - } - // leaf node. - if(root.left === null && root.right === null) { - return 0; - } - if(root.left === null){ - return this.findMinHeight(root.right) + 1; - } - if(root.right === null){ - return this.findMinHeight(root.left) + 1; - } - const lHeight = this.findMinHeight(root.left); - const rHeight = this.findMinHeight(root.right); - return Math.min(lHeight, rHeight) + 1; - }; - this.findMaxHeight = function(root = this.root) { - // empty tree. - if(root === null) { - return -1; - } - // leaf node. - if(root.left === null && root.right === null) { - return 0; - } - if(root.left === null){ - return this.findMaxHeight(root.right) + 1; - } - if(root.right === null){ - return this.findMaxHeight(root.left) + 1; - } - const lHeight = this.findMaxHeight(root.left); - const rHeight = this.findMaxHeight(root.right); - return Math.max(lHeight, rHeight) + 1; - }; - this.isBalanced = function(root = this.root) { + this.root = null; + // change code below this line + // change code above this line + this.findMinHeight = function(root = this.root) { + // empty tree. + if (root === null) { + return -1; + } + // leaf node. + if (root.left === null && root.right === null) { + return 0; + } + if (root.left === null) { + return this.findMinHeight(root.right) + 1; + } + if (root.right === null) { + return this.findMinHeight(root.left) + 1; + } + const lHeight = this.findMinHeight(root.left); + const rHeight = this.findMinHeight(root.right); + return Math.min(lHeight, rHeight) + 1; + }; + this.findMaxHeight = function(root = this.root) { + // empty tree. + if (root === null) { + return -1; + } + // leaf node. + if (root.left === null && root.right === null) { + return 0; + } + if (root.left === null) { + return this.findMaxHeight(root.right) + 1; + } + if (root.right === null) { + return this.findMaxHeight(root.left) + 1; + } + const lHeight = this.findMaxHeight(root.left); + const rHeight = this.findMaxHeight(root.right); + return Math.max(lHeight, rHeight) + 1; + }; + this.isBalanced = function(root = this.root) { + if (root === null) { + return true; + } - if(root === null) { - return true; - } + if (root.left === null && root.right === null) { + return true; + } - if(root.left === null && root.right === null){ - return true; - } + if (root.left === null) { + return this.findMaxHeight(root.right) <= 0; + } - if(root.left === null) { - return this.findMaxHeight(root.right) <= 0; - } + if (root.right === null) { + return this.findMaxHeight(root.left) <= 0; + } - if(root.right === null) { - return this.findMaxHeight(root.left) <= 0; - } - - const lHeight = this.findMaxHeight(root.left); - const rHeight = this.findMaxHeight(root.right); - if(Math.abs(lHeight - rHeight) > 1){ - return false; - } - return this.isBalanced(root.left) && this.isBalanced(root.right); - }; + const lHeight = this.findMaxHeight(root.left); + const rHeight = this.findMaxHeight(root.right); + if (Math.abs(lHeight - rHeight) > 1) { + return false; + } + return this.isBalanced(root.left) && this.isBalanced(root.right); + }; } ``` - - - +
diff --git a/guide/english/certifications/coding-interview-prep/data-structures/find-the-minimum-and-maximum-value-in-a-binary-search-tree/index.md b/guide/english/certifications/coding-interview-prep/data-structures/find-the-minimum-and-maximum-value-in-a-binary-search-tree/index.md index a9acb2bb73..77b9d949af 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/find-the-minimum-and-maximum-value-in-a-binary-search-tree/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/find-the-minimum-and-maximum-value-in-a-binary-search-tree/index.md @@ -1,7 +1,7 @@ --- title: Find the Minimum and Maximum Value in a Binary Search Tree --- -## Find the Minimum and Maximum Value in a Binary Search Tree +# Find the Minimum and Maximum Value in a Binary Search Tree This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/implement-heap-sort-with-a-min-heap/index.md b/guide/english/certifications/coding-interview-prep/data-structures/implement-heap-sort-with-a-min-heap/index.md index 0fe6c4007c..94cbe9f76f 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/implement-heap-sort-with-a-min-heap/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/implement-heap-sort-with-a-min-heap/index.md @@ -1,7 +1,7 @@ --- title: Implement Heap Sort with a Min Heap --- -## Implement Heap Sort with a Min Heap +# Implement Heap Sort with a Min Heap This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/incidence-matrix/index.md b/guide/english/certifications/coding-interview-prep/data-structures/incidence-matrix/index.md index 8495084758..351a2bf079 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/incidence-matrix/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/incidence-matrix/index.md @@ -1,7 +1,7 @@ --- title: Incidence Matrix --- -## Incidence Matrix +# Incidence Matrix This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/index.md b/guide/english/certifications/coding-interview-prep/data-structures/index.md index acba430ed7..6e5f364b48 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/index.md @@ -1,7 +1,7 @@ --- title: Data Structures --- -## Data Structures +# Data Structures This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/insert-an-element-into-a-max-heap/index.md b/guide/english/certifications/coding-interview-prep/data-structures/insert-an-element-into-a-max-heap/index.md index eb235d6c91..18c7171d79 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/insert-an-element-into-a-max-heap/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/insert-an-element-into-a-max-heap/index.md @@ -1,7 +1,7 @@ --- title: Insert an Element into a Max Heap --- -## Insert an Element into a Max Heap +# Insert an Element into a Max Heap This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/invert-a-binary-tree/index.md b/guide/english/certifications/coding-interview-prep/data-structures/invert-a-binary-tree/index.md index e9c51bb075..275373385a 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/invert-a-binary-tree/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/invert-a-binary-tree/index.md @@ -1,33 +1,28 @@ --- title: Invert a Binary Tree --- -## Invert a Binary Tree +# Invert a Binary Tree +--- +## Hints -## Hint: 1 +### Hint 1 Create a invert(node = this.root) method in the BinarySearchTree constructor function. -> _try to solve the problem now_ - - ## Hint: 2 Try to use recursion and think of a base case. -> _try to solve the problem now_ +--- +## Solutions -## Spoiler Alert! - -**Solution ahead!** - - -## Basic Code Solution: +
Solution 1 (Click to Show/Hide) ```js -var displayTree = (tree) => console.log(JSON.stringify(tree, null, 2)); +var displayTree = tree => console.log(JSON.stringify(tree, null, 2)); function Node(value) { this.value = value; this.left = null; @@ -45,15 +40,13 @@ function BinarySearchTree() { this.invert(node.right); } return node; - } - // change code above this line + }; + // change code above this line } ``` Run Code -### Code Explanation: +#### Code Explanation * Using recursion will allow you to traverse each node once and the only extra memory used is the auxiliary temp variable that enables you to swap. You keep swapping the left and right pointers of a node until you reach the leaves which will not do anything as the left and right of them are null references. -## NOTES FOR CONTRIBUTIONS: -**DO NOT** add solutions that are similar to any existing solutions. If you think it is **_similar but better_**, then try to merge (or replace) the existing similar solution. -* Add an explanation of your solution. -* Categorize the solution in one of the following categories — **Basic**, **Intermediate** and **Advanced**. +
+ diff --git a/guide/english/certifications/coding-interview-prep/data-structures/learn-how-a-stack-works/index.md b/guide/english/certifications/coding-interview-prep/data-structures/learn-how-a-stack-works/index.md index 3c6bbcb15c..3fd6a49a74 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/learn-how-a-stack-works/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/learn-how-a-stack-works/index.md @@ -1,23 +1,30 @@ --- title: Learn how a Stack Works --- -## Learn how a Stack Works +# Learn how a Stack Works -### Method: +--- +## Problem Explanation - Stacks are an abstract data structures. - They follow LIFO (Last In First Out) or FILO (First In Last Out) principle. - Stack's insertion and deletion operations are of **O(1)** time complexity. - In JavaScript, arrays can be treated as a Stack since `.push()` and `.pop()` methods have time complexity of **O(1)**. - In this challenge we need to `.pop()` and then `.push()` into the stack. -### Solution: + +--- +## Solutions +
Solution 1 (Click to Show/Hide) + ```js -var homeworkStack = ["BIO12","HIS80","MAT122","PSY44"]; +var homeworkStack = ["BIO12", "HIS80", "MAT122", "PSY44"]; homeworkStack.pop(); homeworkStack.push("CS50"); ``` -### Reference: +#### Relevant Links - [Wikipedia](https://en.wikipedia.org/wiki/Stack_(abstract_data_type)) - Video by [Hackerrank](https://www.youtube.com/watch?v=wjI1WNcIntg) + +
\ No newline at end of file diff --git a/guide/english/certifications/coding-interview-prep/data-structures/perform-a-difference-on-two-sets-of-data/index.md b/guide/english/certifications/coding-interview-prep/data-structures/perform-a-difference-on-two-sets-of-data/index.md index bd163d07c3..5fbc65c87b 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/perform-a-difference-on-two-sets-of-data/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/perform-a-difference-on-two-sets-of-data/index.md @@ -1,7 +1,7 @@ --- title: Perform a Difference on Two Sets of Data --- -## Perform a Difference on Two Sets of Data +# Perform a Difference on Two Sets of Data This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/perform-a-subset-check-on-two-sets-of-data/index.md b/guide/english/certifications/coding-interview-prep/data-structures/perform-a-subset-check-on-two-sets-of-data/index.md index f8d652de17..791aa5f5e8 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/perform-a-subset-check-on-two-sets-of-data/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/perform-a-subset-check-on-two-sets-of-data/index.md @@ -1,7 +1,7 @@ --- title: Perform a Subset Check on Two Sets of Data --- -## Perform a Subset Check on Two Sets of Data +# Perform a Subset Check on Two Sets of Data This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/perform-a-union-on-two-sets/index.md b/guide/english/certifications/coding-interview-prep/data-structures/perform-a-union-on-two-sets/index.md index 8bf3612c75..84c66efcfc 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/perform-a-union-on-two-sets/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/perform-a-union-on-two-sets/index.md @@ -1,7 +1,7 @@ --- title: Perform a Union on Two Sets --- -## Perform a Union on Two Sets +# Perform a Union on Two Sets This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/perform-an-intersection-on-two-sets-of-data/index.md b/guide/english/certifications/coding-interview-prep/data-structures/perform-an-intersection-on-two-sets-of-data/index.md index ebbf149d1e..08f11971b3 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/perform-an-intersection-on-two-sets-of-data/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/perform-an-intersection-on-two-sets-of-data/index.md @@ -1,7 +1,7 @@ --- title: Perform an Intersection on Two Sets of Data --- -## Perform an Intersection on Two Sets of Data +# Perform an Intersection on Two Sets of Data This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/remove-an-element-from-a-max-heap/index.md b/guide/english/certifications/coding-interview-prep/data-structures/remove-an-element-from-a-max-heap/index.md index 0f9f8cd981..efaabeae35 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/remove-an-element-from-a-max-heap/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/remove-an-element-from-a-max-heap/index.md @@ -1,7 +1,7 @@ --- title: Remove an Element from a Max Heap --- -## Remove an Element from a Max Heap +# Remove an Element from a Max Heap This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/remove-elements-from-a-linked-list-by-index/index.md b/guide/english/certifications/coding-interview-prep/data-structures/remove-elements-from-a-linked-list-by-index/index.md index 439dc1263c..10ac565bd8 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/remove-elements-from-a-linked-list-by-index/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/remove-elements-from-a-linked-list-by-index/index.md @@ -1,7 +1,7 @@ --- title: Remove Elements from a Linked List by Index --- -## Remove Elements from a Linked List by Index +# Remove Elements from a Linked List by Index This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/remove-elements-from-a-linked-list/index.md b/guide/english/certifications/coding-interview-prep/data-structures/remove-elements-from-a-linked-list/index.md index 1ac6c5db64..e8aba35a39 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/remove-elements-from-a-linked-list/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/remove-elements-from-a-linked-list/index.md @@ -1,7 +1,7 @@ --- title: Remove Elements from a Linked List --- -## Remove Elements from a Linked List +# Remove Elements from a Linked List This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/remove-items-from-a-set-in-es6/index.md b/guide/english/certifications/coding-interview-prep/data-structures/remove-items-from-a-set-in-es6/index.md index b67c1d39b1..9b6ff0e4cf 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/remove-items-from-a-set-in-es6/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/remove-items-from-a-set-in-es6/index.md @@ -1,7 +1,7 @@ --- title: Remove items from a set in ES6 --- -## Remove items from a set in ES6 +# Remove items from a set in ES6 This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/reverse-a-doubly-linked-list/index.md b/guide/english/certifications/coding-interview-prep/data-structures/reverse-a-doubly-linked-list/index.md index 3804e5a8e4..5616196eb6 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/reverse-a-doubly-linked-list/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/reverse-a-doubly-linked-list/index.md @@ -2,15 +2,20 @@ title: Reverse a Doubly Linked List --- -## Reverse a Doubly Linked List +# Reverse a Doubly Linked List -### Method: +--- +## Problem Explanation - Reverse the doubly linked list, and update previous and next variables for each member node accordingly. - Define privileged methods add() and reverse(). - add() will find the end of the list and append new entries at this location. - reverse() will swap entries one pair at a time using a temporary variable. -### Solution: + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) ```js var Node = function(data, prev) { @@ -31,32 +36,32 @@ var DoublyLinkedList = function() { this.head = node; this.tail = node; } else { - while (currentNode.next) { - previousNode = currentNode; + while (currentNode.next) { + previousNode = currentNode; currentNode = currentNode.next; } node.prev = currentNode; currentNode.next = node; this.tail = node; } - }; + }; this.reverse = function() { let temp = null; let currentNode = this.head; - + if (this.head === null) { return null; } - + this.tail = currentNode; - + while (currentNode) { - temp = currentNode.prev; + temp = currentNode.prev; currentNode.prev = currentNode.next; currentNode.next = temp; currentNode = currentNode.prev; } - + if (temp != null) { this.head = temp.prev; } @@ -65,5 +70,7 @@ var DoublyLinkedList = function() { }; ``` -### Reference: +#### Relevant Links - [Wikipedia](https://en.wikipedia.org/wiki/Doubly_linked_list) + +
\ No newline at end of file diff --git a/guide/english/certifications/coding-interview-prep/data-structures/search-within-a-linked-list/index.md b/guide/english/certifications/coding-interview-prep/data-structures/search-within-a-linked-list/index.md index 87762d3f0f..422b7fff78 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/search-within-a-linked-list/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/search-within-a-linked-list/index.md @@ -1,7 +1,7 @@ --- title: Search within a Linked List --- -## Search within a Linked List +# Search within a Linked List This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/typed-arrays/index.md b/guide/english/certifications/coding-interview-prep/data-structures/typed-arrays/index.md index 7efea05b61..349be8bd9c 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/typed-arrays/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/typed-arrays/index.md @@ -1,13 +1,19 @@ --- title: Typed Arrays --- -## Typed Arrays +# Typed Arrays -### Method: +--- +## Problem Explanation - In this challenge, first we need to create a buffer of 64 bytes. We can use `ArrayBuffer()` constructor. - After creating a buffer we need to create an Int32Array, for that we can use `Int32Array()` constructor. -### Solution: + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) + ```js //Create a buffer of 64 bytes var buffer = new ArrayBuffer(64); @@ -16,6 +22,8 @@ var buffer = new ArrayBuffer(64); var i32View = new Int32Array(buffer); ``` -### References: +#### Relevant Links - [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) - [TypedArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays) + +
\ No newline at end of file diff --git a/guide/english/certifications/coding-interview-prep/data-structures/use-.has-and-.size-on-an-es6-set/index.md b/guide/english/certifications/coding-interview-prep/data-structures/use-.has-and-.size-on-an-es6-set/index.md index e96e241ebf..d255aa50a1 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/use-.has-and-.size-on-an-es6-set/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/use-.has-and-.size-on-an-es6-set/index.md @@ -1,7 +1,7 @@ --- title: Use .has and .size on an ES6 Set --- -## Use .has and .size on an ES6 Set +# Use .has and .size on an ES6 Set This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/use-breadth-first-search-in-a-binary-search-tree/index.md b/guide/english/certifications/coding-interview-prep/data-structures/use-breadth-first-search-in-a-binary-search-tree/index.md index 6cfe3ba6f3..6db22b8e19 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/use-breadth-first-search-in-a-binary-search-tree/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/use-breadth-first-search-in-a-binary-search-tree/index.md @@ -1,7 +1,7 @@ --- title: Use Breadth First Search in a Binary Search Tree --- -## Use Breadth First Search in a Binary Search Tree +# Use Breadth First Search in a Binary Search Tree This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/use-depth-first-search-in-a-binary-search-tree/index.md b/guide/english/certifications/coding-interview-prep/data-structures/use-depth-first-search-in-a-binary-search-tree/index.md index 501f42c04d..ccb61baa38 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/use-depth-first-search-in-a-binary-search-tree/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/use-depth-first-search-in-a-binary-search-tree/index.md @@ -1,7 +1,7 @@ --- title: Use Depth First Search in a Binary Search Tree --- -## Use Depth First Search in a Binary Search Tree +# Use Depth First Search in a Binary Search Tree This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/use-spread-and-notes-for-es5-set-integration/index.md b/guide/english/certifications/coding-interview-prep/data-structures/use-spread-and-notes-for-es5-set-integration/index.md index b61c79428f..19ca41ac21 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/use-spread-and-notes-for-es5-set-integration/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/use-spread-and-notes-for-es5-set-integration/index.md @@ -1,7 +1,7 @@ --- title: Use Spread and Notes for ES5 Set() Integration --- -## Use Spread and Notes for ES5 Set() Integration +# Use Spread and Notes for ES5 Set() Integration This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/data-structures/work-with-nodes-in-a-linked-list/index.md b/guide/english/certifications/coding-interview-prep/data-structures/work-with-nodes-in-a-linked-list/index.md index 0047c65ee1..cb2d2dcdda 100644 --- a/guide/english/certifications/coding-interview-prep/data-structures/work-with-nodes-in-a-linked-list/index.md +++ b/guide/english/certifications/coding-interview-prep/data-structures/work-with-nodes-in-a-linked-list/index.md @@ -1,7 +1,7 @@ --- title: Work with Nodes in a Linked List --- -## Work with Nodes in a Linked List +# Work with Nodes in a Linked List This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/index.md b/guide/english/certifications/coding-interview-prep/index.md index 88bc3931d0..adb3c18a9d 100644 --- a/guide/english/certifications/coding-interview-prep/index.md +++ b/guide/english/certifications/coding-interview-prep/index.md @@ -1,7 +1,7 @@ --- title: Coding Interview Prep --- -## Coding Interview Prep +# Coding Interview Prep First of all, we can start with the premise and the fact that almost all companies leave to the applicant's choice to choose their preferable programming language for the interview. Since you have this advantage, you should pick the language you are most familiar with. If you are a rookie in this domain and you want to apply for your first job, it's recommended to start with the language which seems more interesting to you and makes you comfortable when you write code. diff --git a/guide/english/certifications/coding-interview-prep/project-euler/index.md b/guide/english/certifications/coding-interview-prep/project-euler/index.md index 9250c5f53d..4b938f9283 100644 --- a/guide/english/certifications/coding-interview-prep/project-euler/index.md +++ b/guide/english/certifications/coding-interview-prep/project-euler/index.md @@ -2,7 +2,7 @@ title: Project Euler --- -## Project Euler +# Project Euler [Project Euler](https://projecteuler.net/), named for mathematician Leonard Euler, is a popular resource for practicing writing efficient algorithms. It is inspired by the shared goal of mathematicians and programmers to compose elegant and efficient solutions to complex problems. Project Euler is language agnostic. Rather than testing coded solutions, it presents a question to users and asks them only to input the correct answer. For this reason it is a popular platform for people who are learning new languages as well as those who want to practice writing more efficient solutions. The challenges presented by Project Euler are math problems of increasing complexity. Although all of these challenges can be solved by an algorithm that runs in less than a minute, the most obvious may take hours or even days to complete. The Project Euler platform does not run your algorithm and does not grade you based on its efficiency, but once you have solved the problem to arrive at a correct solution you will be granted access to a discussion forum of the challenge where you can get community help on how to improve your approach. #### More Information: diff --git a/guide/english/certifications/coding-interview-prep/project-euler/problem-1-multiples-of-3-and-5/index.md b/guide/english/certifications/coding-interview-prep/project-euler/problem-1-multiples-of-3-and-5/index.md index 7712878d24..1b180d5b09 100644 --- a/guide/english/certifications/coding-interview-prep/project-euler/problem-1-multiples-of-3-and-5/index.md +++ b/guide/english/certifications/coding-interview-prep/project-euler/problem-1-multiples-of-3-and-5/index.md @@ -1,19 +1,26 @@ --- title: Multiples of 3 and 5 --- -## Problem 1: Multiples of 3 and 5 +# Problem 1: Multiples of 3 and 5 -### Method: +--- +## Problem Explanation - We can find if a number is divisble by another number with the help of `%` modulo operator. - `num1 % num2` returns `0` if there's no remainder while doing `num1/num2`. - Starting from `i = 3` because that's the first number that's divisble by 3 or 5, we loop through till the `number` provided. - If the number is divisible either by 3 or 5, we add that to the variable `sum` and finally return it. -### Solution: + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) + ```js function multiplesOf3and5(number) { - let sum = 0, i = 3; - while (i < number){ + let sum = 0, + i = 3; + while (i < number) { if (i % 3 == 0 || i % 5 == 0) sum += i; i++; } @@ -22,5 +29,7 @@ function multiplesOf3and5(number) { ``` -### Reference: +#### Relevant Links - [Modulo operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Remainder_()) + +
\ No newline at end of file diff --git a/guide/english/certifications/coding-interview-prep/project-euler/problem-10-summation-of-primes/index.md b/guide/english/certifications/coding-interview-prep/project-euler/problem-10-summation-of-primes/index.md index 4fd15a6b83..bd148cabf8 100644 --- a/guide/english/certifications/coding-interview-prep/project-euler/problem-10-summation-of-primes/index.md +++ b/guide/english/certifications/coding-interview-prep/project-euler/problem-10-summation-of-primes/index.md @@ -1,15 +1,20 @@ --- title: Summation of primes --- -## Problem 10: Summation of primes +# Problem 10: Summation of primes -### Method: +--- +## Problem Explanation - In this challenge we need to find sum of all prime numbers up to `n`. - Example: - If `n = 10` then prime numbers before it are `2, 3, 5, 7` and their sum is `17`. - We've used Sieve of Eratosthenes algorithm to find prime numbers in the below solution. -### Solution: + +--- +## Solutions +
Solution 1 (Click to Show/Hide) + ```js function primeSummation(n) { @@ -50,5 +55,6 @@ function primeSummation(n) { ``` -### References: +#### Relevant Links - Sieve of Eratosthenes [Wikipedia](https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes) +
diff --git a/guide/english/certifications/coding-interview-prep/project-euler/problem-2-even-fibonacci-numbers/index.md b/guide/english/certifications/coding-interview-prep/project-euler/problem-2-even-fibonacci-numbers/index.md index 1c749ae847..3ae469cd26 100644 --- a/guide/english/certifications/coding-interview-prep/project-euler/problem-2-even-fibonacci-numbers/index.md +++ b/guide/english/certifications/coding-interview-prep/project-euler/problem-2-even-fibonacci-numbers/index.md @@ -1,9 +1,10 @@ --- title: Even Fibonacci Numbers --- -## Problem 2: Even Fibonacci Numbers +# Problem 2: Even Fibonacci Numbers -### Method: +--- +## Problem Explanation - A fibonacci sequence is a sequence where `fib(n) = fib(n-1) + fib(n-1)`. - In this challenge we have to sum all the even numbers upto `nth` term in the sequence. - Example for `fiboEvenSum(10)`: @@ -13,34 +14,51 @@ title: Even Fibonacci Numbers + Sum of all even number in the above sequence is: 2 + 8 + 34 = 44 -### Solution: +#### Relevant Links +- [Wikipedia](https://en.wikipedia.org/wiki/Fibonacci_number) -#### Basic Solution - Iterative: + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) + +Iterative ```js function fiboEvenSum(n) { - let first = 1, second = 2, sum = 2, fibNum; // declaring and initializing variables + let first = 1, + second = 2, + sum = 2, + fibNum; // declaring and initializing variables if (n <= 1) return sum; // edge case - for (let i = 3; i <= n; i++){ // looping till n - fibNum = first + second; // getting the ith fibonacci number + for (let i = 3; i <= n; i++) { + // looping till n + fibNum = first + second; // getting the ith fibonacci number first = second; second = fibNum; - if (fibNum%2 == 0) sum+=fibNum; // If even add to the sum variable + if (fibNum % 2 == 0) sum += fibNum; // If even add to the sum variable } return sum; } ``` -#### Advanced Solution - Recursive: +
+ +
Solution 2 (Click to Show/Hide) + +Recursive ```js -// We use memoization technique to save ith fibonacci number to the fib array -function fiboEvenSum(n){ - const fib = [1, 1, 2]; +// We use memoization technique to save ith fibonacci number to the fib array +function fiboEvenSum(n) { + const fib = [1, 1, 2]; let sumEven = fib[2]; - function fibonacci(n){ - if (n <= 1) return fib[n]; // base condition - else if (fib[n]) return fib[n]; // if the number exists in the array we cache it and return + function fibonacci(n) { + if (n <= 1) return fib[n]; + // base condition + else if (fib[n]) return fib[n]; + // if the number exists in the array we cache it and return else { - fib[n] = fibonacci(n-1) + fibonacci(n-2); // otherwise calculcate and save it to the array - if (fib[n]%2 == 0) sumEven+=fib[n]; //if the number is even, add it to the sumEven variable + fib[n] = fibonacci(n - 1) + fibonacci(n - 2); // otherwise calculcate and save it to the array + if (fib[n] % 2 == 0) sumEven += fib[n]; //if the number is even, add it to the sumEven variable return fib[n]; } } @@ -48,6 +66,6 @@ function fiboEvenSum(n){ return sumEven; } ``` +
+ -### References: -- [Wikipedia](https://en.wikipedia.org/wiki/Fibonacci_number) diff --git a/guide/english/certifications/coding-interview-prep/project-euler/problem-3-largest-prime-factor/index.md b/guide/english/certifications/coding-interview-prep/project-euler/problem-3-largest-prime-factor/index.md index ae2dbe8b9a..a37aca9308 100644 --- a/guide/english/certifications/coding-interview-prep/project-euler/problem-3-largest-prime-factor/index.md +++ b/guide/english/certifications/coding-interview-prep/project-euler/problem-3-largest-prime-factor/index.md @@ -1,29 +1,35 @@ --- title: Largest prime factor --- -## Problem 3: Largest prime factor +# Problem 3: Largest prime factor -### Method: +--- +## Problem Explanation - To find the largest prime factor of a number, we start from the smallest prime factor 2 and divide the number with it. - If the remainder is 0 that means the number is divisible by that prime number, we keep dividing the number by same prime number until that number is no more divisible by that prime number. - After that, we incrememnt the prime factor by 1 and repeat this process till the number becomes 1. -### Solution: + +--- +## Solutions +
Solution 1 (Click to Show/Hide) + ```js function largestPrimeFactor(number) { - let prime = 2, max = 1; - while (prime <= number){ + let prime = 2, + max = 1; + while (prime <= number) { if (number % prime == 0) { max = prime; - number = number/prime; - } - else prime++; //Only increment the prime number if the number isn't divisible by it + number = number / prime; + } else prime++; //Only increment the prime number if the number isn't divisible by it } return max; } ``` -### Resources: +#### Relevant Links - [Wikipedia](https://en.wikipedia.org/wiki/Prime_number) +
diff --git a/guide/english/certifications/coding-interview-prep/project-euler/problem-4-largest-palindrome-product/index.md b/guide/english/certifications/coding-interview-prep/project-euler/problem-4-largest-palindrome-product/index.md index 742597c52a..8441c8a579 100644 --- a/guide/english/certifications/coding-interview-prep/project-euler/problem-4-largest-palindrome-product/index.md +++ b/guide/english/certifications/coding-interview-prep/project-euler/problem-4-largest-palindrome-product/index.md @@ -1,51 +1,54 @@ --- title: Largest palindrome product --- -## Problem 4: Largest palindrome product +# Problem 4: Largest palindrome product -### Method: +--- +## Problem Explanation - A palindromic number is the one that when reversed reads the same. - The largest number obtained from product of two 3 digit number is `999 * 999`, so we can make a loop that starts by producting the largest number and check if that number is palindromic or not. -### Solution: + + +--- +## Solutions +
Solution 1 (Click to Show/Hide) + ```js function largestPalindromeProduct(n) { - //To get the maximum n digit number, + operator type castes String to Number type - let max = +[...Array(n)].reduce((a, c) => a+=9, ""); - + let max = +[...Array(n)].reduce((a, c) => (a += 9), ""); + //Next we get minimum n digit number from the max - let min = (max+1)/10; - + let min = (max + 1) / 10; + //To store the result let res = []; - + //Starting the loop from max to min - for (let i = max; i >= min; i--){ - - //Another loop - for (let j = max; j >= min; j--){ - + for (let i = max; i >= min; i--) { + //Another loop + for (let j = max; j >= min; j--) { //Getting the product - let num = i*j; - + let num = i * j; + //Reversing the number - let numReverse = [...String(num)].reverse().join(''); - + let numReverse = [...String(num)].reverse().join(""); + //Checking for palindromic number if (num == numReverse) { - //Pushing the number into array and breaking the loop for efficiency res.push(num); break; } } } - + // Returning the maximum of the result array return Math.max(...res); } ``` -### References: +#### Relevant Links - [Wikipedia](https://en.wikipedia.org/wiki/Palindromic_number) +
diff --git a/guide/english/certifications/coding-interview-prep/project-euler/problem-5-smallest-multiple/index.md b/guide/english/certifications/coding-interview-prep/project-euler/problem-5-smallest-multiple/index.md index ee9ce4b4e1..a4d0f8ba12 100644 --- a/guide/english/certifications/coding-interview-prep/project-euler/problem-5-smallest-multiple/index.md +++ b/guide/english/certifications/coding-interview-prep/project-euler/problem-5-smallest-multiple/index.md @@ -1,39 +1,45 @@ --- title: Smallest multiple --- -## Problem 5: Smallest multiple +# Problem 5: Smallest multiple -### Method: +--- +## Problem Explanation - In this challenge we need to find the LCM of 1 to n numbers. - To find LCM of a number we use the following formula: - ![lcm](https://wikimedia.org/api/rest_v1/media/math/render/svg/9453a93953efe119b7502c1827aeeb869ab121d6) - To find GCD (Greatest Common Divisor) of two number we use Euclidean algorithm. - Once we get LCM of two numbers, we can get LCM of the numbers from 1 to n. -### Solution: + +--- +## Solutions +
Solution 1 (Click to Show/Hide) + ```js //LCM of two numbers -function lcm(a, b){ - return (a*b)/gcd(a, b); +function lcm(a, b) { + return (a * b) / gcd(a, b); } -//Euclidean recursive algorithm -function gcd(a, b){ +//Euclidean recursive algorithm +function gcd(a, b) { if (b === 0) return a; - return gcd(b, a%b); + return gcd(b, a % b); } -function smallestMult(n){ +function smallestMult(n) { let maxLCM = 1; - + //Getting the LCM in the range - for (let i = 2; i <= n; i++){ + for (let i = 2; i <= n; i++) { maxLCM = lcm(maxLCM, i); } return maxLCM; } ``` -### References: +#### Relevant Links - [Euclidean algorithm](https://en.wikipedia.org/wiki/Euclidean_algorithm) - [LCM](https://en.wikipedia.org/wiki/Least_common_multiple) +
diff --git a/guide/english/certifications/coding-interview-prep/project-euler/problem-6-sum-square-difference/index.md b/guide/english/certifications/coding-interview-prep/project-euler/problem-6-sum-square-difference/index.md index 2f8ad0e650..817220a5c0 100644 --- a/guide/english/certifications/coding-interview-prep/project-euler/problem-6-sum-square-difference/index.md +++ b/guide/english/certifications/coding-interview-prep/project-euler/problem-6-sum-square-difference/index.md @@ -1,9 +1,10 @@ --- title: Sum square difference --- -## Problem 6: Sum square difference +# Problem 6: Sum square difference -### Method: +--- +## Problem Explanation - Sum of first n natural numbers can be calculated by using this formula: - ![sum of n numbers](https://wikimedia.org/api/rest_v1/media/math/render/svg/99476e25466549387c585cb4de44e90f6cbe4cf2) @@ -12,7 +13,11 @@ title: Sum square difference - We can calculate the values using the above formula and subtract them to get the result. -### Solution: + +--- +## Solutions +
Solution 1 (Click to Show/Hide) + ```js function sumSquareDifference(n) { const sumOfN = (n*(n+1))/2; @@ -23,7 +28,9 @@ function sumSquareDifference(n) { } ``` -### References: +#### Relevant Links - [Sum of n numbers - Wikipedia](https://en.wikipedia.org/wiki/1_%2B_2_%2B_3_%2B_4_%2B_%E2%8B%AF) - [Sum of n square numbers - Wikipedia](https://en.wikipedia.org/wiki/Square_pyramidal_number) + +
\ No newline at end of file diff --git a/guide/english/certifications/coding-interview-prep/project-euler/problem-7-10001st-prime/index.md b/guide/english/certifications/coding-interview-prep/project-euler/problem-7-10001st-prime/index.md index 4992a14d2c..743589f62b 100644 --- a/guide/english/certifications/coding-interview-prep/project-euler/problem-7-10001st-prime/index.md +++ b/guide/english/certifications/coding-interview-prep/project-euler/problem-7-10001st-prime/index.md @@ -1,49 +1,54 @@ --- title: 10001st prime --- -## Problem 7: 10001st prime -### Method: +# Problem 7: 10001st prime + +--- +## Problem Explanation - A prime number is a number which is divided by 1 and itself. - We can find a number is prime if it's not divisible by other prime numbers smaller than itself. -### Solution: + +--- +## Solutions +
Solution 1 (Click to Show/Hide) + ```js function nthPrime(n) { - //Primes array which will store all the prime numbers const primes = [2]; - + //Num is the number we want to check - let num = 3, isPrime = true; - + let num = 3, + isPrime = true; + //Looping until primes array is equal to n - while (primes.length < n){ - + while (primes.length < n) { //All the primes numbers of a number is always <= its square root let max = Math.ceil(Math.sqrt(num)); - - for (let i = 0; primes[i] <= max; i++){ + + for (let i = 0; primes[i] <= max; i++) { if (num % primes[i] == 0) { - //Looping till we find the prime isPrime = false; break; } } - + //if Prime found, push it to the array if (isPrime) primes.push(num); isPrime = true; - - //An optimization technique, since we know of all even numbers only 2 is a prime number, we can skip the rest - num+=2; - } - - //Returning the last number - return primes[primes.length-1]; + //An optimization technique, since we know of all even numbers only 2 is a prime number, we can skip the rest + num += 2; + } + + //Returning the last number + return primes[primes.length - 1]; } ``` -### References: +#### Relevant Links - [Wikipedia](https://en.wikipedia.org/wiki/Prime_number) + +
\ No newline at end of file diff --git a/guide/english/certifications/coding-interview-prep/project-euler/problem-8-largest-product-in-a-series/index.md b/guide/english/certifications/coding-interview-prep/project-euler/problem-8-largest-product-in-a-series/index.md index bc6f47ac5f..adc45fb968 100644 --- a/guide/english/certifications/coding-interview-prep/project-euler/problem-8-largest-product-in-a-series/index.md +++ b/guide/english/certifications/coding-interview-prep/project-euler/problem-8-largest-product-in-a-series/index.md @@ -1,9 +1,10 @@ --- title: Largest product in a series --- -## Problem 8: Largest product in a series +# Problem 8: Largest product in a series -### Method: +--- +## Problem Explanation - In this challenge we need to get the largest product of `n` cosnecutive numbers. - We can use the sliding window method to solve this problem. @@ -14,19 +15,1026 @@ title: Largest product in a series 4. Move the pointer by 1 element. 5. Repeat the process. - This algorithm's big O is **O(n\*m)** where n is the length of the array and m is the number of consecutive elements. -### Solution: + + +--- +## Solutions +
Solution 1 (Click to Show/Hide) + ```js function largestProductinaSeries(n) { - let thousandDigits = [7,3,1,6,7,1,7,6,5,3,1,3,3,0,6,2,4,9,1,9,2,2,5,1,1,9,6,7,4,4,2,6,5,7,4,7,4,2,3,5,5,3,4,9,1,9,4,9,3,4,9,6,9,8,3,5,2,0,3,1,2,7,7,4,5,0,6,3,2,6,2,3,9,5,7,8,3,1,8,0,1,6,9,8,4,8,0,1,8,6,9,4,7,8,8,5,1,8,4,3,8,5,8,6,1,5,6,0,7,8,9,1,1,2,9,4,9,4,9,5,4,5,9,5,0,1,7,3,7,9,5,8,3,3,1,9,5,2,8,5,3,2,0,8,8,0,5,5,1,1,1,2,5,4,0,6,9,8,7,4,7,1,5,8,5,2,3,8,6,3,0,5,0,7,1,5,6,9,3,2,9,0,9,6,3,2,9,5,2,2,7,4,4,3,0,4,3,5,5,7,6,6,8,9,6,6,4,8,9,5,0,4,4,5,2,4,4,5,2,3,1,6,1,7,3,1,8,5,6,4,0,3,0,9,8,7,1,1,1,2,1,7,2,2,3,8,3,1,1,3,6,2,2,2,9,8,9,3,4,2,3,3,8,0,3,0,8,1,3,5,3,3,6,2,7,6,6,1,4,2,8,2,8,0,6,4,4,4,4,8,6,6,4,5,2,3,8,7,4,9,3,0,3,5,8,9,0,7,2,9,6,2,9,0,4,9,1,5,6,0,4,4,0,7,7,2,3,9,0,7,1,3,8,1,0,5,1,5,8,5,9,3,0,7,9,6,0,8,6,6,7,0,1,7,2,4,2,7,1,2,1,8,8,3,9,9,8,7,9,7,9,0,8,7,9,2,2,7,4,9,2,1,9,0,1,6,9,9,7,2,0,8,8,8,0,9,3,7,7,6,6,5,7,2,7,3,3,3,0,0,1,0,5,3,3,6,7,8,8,1,2,2,0,2,3,5,4,2,1,8,0,9,7,5,1,2,5,4,5,4,0,5,9,4,7,5,2,2,4,3,5,2,5,8,4,9,0,7,7,1,1,6,7,0,5,5,6,0,1,3,6,0,4,8,3,9,5,8,6,4,4,6,7,0,6,3,2,4,4,1,5,7,2,2,1,5,5,3,9,7,5,3,6,9,7,8,1,7,9,7,7,8,4,6,1,7,4,0,6,4,9,5,5,1,4,9,2,9,0,8,6,2,5,6,9,3,2,1,9,7,8,4,6,8,6,2,2,4,8,2,8,3,9,7,2,2,4,1,3,7,5,6,5,7,0,5,6,0,5,7,4,9,0,2,6,1,4,0,7,9,7,2,9,6,8,6,5,2,4,1,4,5,3,5,1,0,0,4,7,4,8,2,1,6,6,3,7,0,4,8,4,4,0,3,1,9,9,8,9,0,0,0,8,8,9,5,2,4,3,4,5,0,6,5,8,5,4,1,2,2,7,5,8,8,6,6,6,8,8,1,1,6,4,2,7,1,7,1,4,7,9,9,2,4,4,4,2,9,2,8,2,3,0,8,6,3,4,6,5,6,7,4,8,1,3,9,1,9,1,2,3,1,6,2,8,2,4,5,8,6,1,7,8,6,6,4,5,8,3,5,9,1,2,4,5,6,6,5,2,9,4,7,6,5,4,5,6,8,2,8,4,8,9,1,2,8,8,3,1,4,2,6,0,7,6,9,0,0,4,2,2,4,2,1,9,0,2,2,6,7,1,0,5,5,6,2,6,3,2,1,1,1,1,1,0,9,3,7,0,5,4,4,2,1,7,5,0,6,9,4,1,6,5,8,9,6,0,4,0,8,0,7,1,9,8,4,0,3,8,5,0,9,6,2,4,5,5,4,4,4,3,6,2,9,8,1,2,3,0,9,8,7,8,7,9,9,2,7,2,4,4,2,8,4,9,0,9,1,8,8,8,4,5,8,0,1,5,6,1,6,6,0,9,7,9,1,9,1,3,3,8,7,5,4,9,9,2,0,0,5,2,4,0,6,3,6,8,9,9,1,2,5,6,0,7,1,7,6,0,6,0,5,8,8,6,1,1,6,4,6,7,1,0,9,4,0,5,0,7,7,5,4,1,0,0,2,2,5,6,9,8,3,1,5,5,2,0,0,0,5,5,9,3,5,7,2,9,7,2,5,7,1,6,3,6,2,6,9,5,6,1,8,8,2,6,7,0,4,2,8,2,5,2,4,8,3,6,0,0,8,2,3,2,5,7,5,3,0,4,2,0,7,5,2,9,6,3,4,5,0]; - + let thousandDigits = [ + 7, + 3, + 1, + 6, + 7, + 1, + 7, + 6, + 5, + 3, + 1, + 3, + 3, + 0, + 6, + 2, + 4, + 9, + 1, + 9, + 2, + 2, + 5, + 1, + 1, + 9, + 6, + 7, + 4, + 4, + 2, + 6, + 5, + 7, + 4, + 7, + 4, + 2, + 3, + 5, + 5, + 3, + 4, + 9, + 1, + 9, + 4, + 9, + 3, + 4, + 9, + 6, + 9, + 8, + 3, + 5, + 2, + 0, + 3, + 1, + 2, + 7, + 7, + 4, + 5, + 0, + 6, + 3, + 2, + 6, + 2, + 3, + 9, + 5, + 7, + 8, + 3, + 1, + 8, + 0, + 1, + 6, + 9, + 8, + 4, + 8, + 0, + 1, + 8, + 6, + 9, + 4, + 7, + 8, + 8, + 5, + 1, + 8, + 4, + 3, + 8, + 5, + 8, + 6, + 1, + 5, + 6, + 0, + 7, + 8, + 9, + 1, + 1, + 2, + 9, + 4, + 9, + 4, + 9, + 5, + 4, + 5, + 9, + 5, + 0, + 1, + 7, + 3, + 7, + 9, + 5, + 8, + 3, + 3, + 1, + 9, + 5, + 2, + 8, + 5, + 3, + 2, + 0, + 8, + 8, + 0, + 5, + 5, + 1, + 1, + 1, + 2, + 5, + 4, + 0, + 6, + 9, + 8, + 7, + 4, + 7, + 1, + 5, + 8, + 5, + 2, + 3, + 8, + 6, + 3, + 0, + 5, + 0, + 7, + 1, + 5, + 6, + 9, + 3, + 2, + 9, + 0, + 9, + 6, + 3, + 2, + 9, + 5, + 2, + 2, + 7, + 4, + 4, + 3, + 0, + 4, + 3, + 5, + 5, + 7, + 6, + 6, + 8, + 9, + 6, + 6, + 4, + 8, + 9, + 5, + 0, + 4, + 4, + 5, + 2, + 4, + 4, + 5, + 2, + 3, + 1, + 6, + 1, + 7, + 3, + 1, + 8, + 5, + 6, + 4, + 0, + 3, + 0, + 9, + 8, + 7, + 1, + 1, + 1, + 2, + 1, + 7, + 2, + 2, + 3, + 8, + 3, + 1, + 1, + 3, + 6, + 2, + 2, + 2, + 9, + 8, + 9, + 3, + 4, + 2, + 3, + 3, + 8, + 0, + 3, + 0, + 8, + 1, + 3, + 5, + 3, + 3, + 6, + 2, + 7, + 6, + 6, + 1, + 4, + 2, + 8, + 2, + 8, + 0, + 6, + 4, + 4, + 4, + 4, + 8, + 6, + 6, + 4, + 5, + 2, + 3, + 8, + 7, + 4, + 9, + 3, + 0, + 3, + 5, + 8, + 9, + 0, + 7, + 2, + 9, + 6, + 2, + 9, + 0, + 4, + 9, + 1, + 5, + 6, + 0, + 4, + 4, + 0, + 7, + 7, + 2, + 3, + 9, + 0, + 7, + 1, + 3, + 8, + 1, + 0, + 5, + 1, + 5, + 8, + 5, + 9, + 3, + 0, + 7, + 9, + 6, + 0, + 8, + 6, + 6, + 7, + 0, + 1, + 7, + 2, + 4, + 2, + 7, + 1, + 2, + 1, + 8, + 8, + 3, + 9, + 9, + 8, + 7, + 9, + 7, + 9, + 0, + 8, + 7, + 9, + 2, + 2, + 7, + 4, + 9, + 2, + 1, + 9, + 0, + 1, + 6, + 9, + 9, + 7, + 2, + 0, + 8, + 8, + 8, + 0, + 9, + 3, + 7, + 7, + 6, + 6, + 5, + 7, + 2, + 7, + 3, + 3, + 3, + 0, + 0, + 1, + 0, + 5, + 3, + 3, + 6, + 7, + 8, + 8, + 1, + 2, + 2, + 0, + 2, + 3, + 5, + 4, + 2, + 1, + 8, + 0, + 9, + 7, + 5, + 1, + 2, + 5, + 4, + 5, + 4, + 0, + 5, + 9, + 4, + 7, + 5, + 2, + 2, + 4, + 3, + 5, + 2, + 5, + 8, + 4, + 9, + 0, + 7, + 7, + 1, + 1, + 6, + 7, + 0, + 5, + 5, + 6, + 0, + 1, + 3, + 6, + 0, + 4, + 8, + 3, + 9, + 5, + 8, + 6, + 4, + 4, + 6, + 7, + 0, + 6, + 3, + 2, + 4, + 4, + 1, + 5, + 7, + 2, + 2, + 1, + 5, + 5, + 3, + 9, + 7, + 5, + 3, + 6, + 9, + 7, + 8, + 1, + 7, + 9, + 7, + 7, + 8, + 4, + 6, + 1, + 7, + 4, + 0, + 6, + 4, + 9, + 5, + 5, + 1, + 4, + 9, + 2, + 9, + 0, + 8, + 6, + 2, + 5, + 6, + 9, + 3, + 2, + 1, + 9, + 7, + 8, + 4, + 6, + 8, + 6, + 2, + 2, + 4, + 8, + 2, + 8, + 3, + 9, + 7, + 2, + 2, + 4, + 1, + 3, + 7, + 5, + 6, + 5, + 7, + 0, + 5, + 6, + 0, + 5, + 7, + 4, + 9, + 0, + 2, + 6, + 1, + 4, + 0, + 7, + 9, + 7, + 2, + 9, + 6, + 8, + 6, + 5, + 2, + 4, + 1, + 4, + 5, + 3, + 5, + 1, + 0, + 0, + 4, + 7, + 4, + 8, + 2, + 1, + 6, + 6, + 3, + 7, + 0, + 4, + 8, + 4, + 4, + 0, + 3, + 1, + 9, + 9, + 8, + 9, + 0, + 0, + 0, + 8, + 8, + 9, + 5, + 2, + 4, + 3, + 4, + 5, + 0, + 6, + 5, + 8, + 5, + 4, + 1, + 2, + 2, + 7, + 5, + 8, + 8, + 6, + 6, + 6, + 8, + 8, + 1, + 1, + 6, + 4, + 2, + 7, + 1, + 7, + 1, + 4, + 7, + 9, + 9, + 2, + 4, + 4, + 4, + 2, + 9, + 2, + 8, + 2, + 3, + 0, + 8, + 6, + 3, + 4, + 6, + 5, + 6, + 7, + 4, + 8, + 1, + 3, + 9, + 1, + 9, + 1, + 2, + 3, + 1, + 6, + 2, + 8, + 2, + 4, + 5, + 8, + 6, + 1, + 7, + 8, + 6, + 6, + 4, + 5, + 8, + 3, + 5, + 9, + 1, + 2, + 4, + 5, + 6, + 6, + 5, + 2, + 9, + 4, + 7, + 6, + 5, + 4, + 5, + 6, + 8, + 2, + 8, + 4, + 8, + 9, + 1, + 2, + 8, + 8, + 3, + 1, + 4, + 2, + 6, + 0, + 7, + 6, + 9, + 0, + 0, + 4, + 2, + 2, + 4, + 2, + 1, + 9, + 0, + 2, + 2, + 6, + 7, + 1, + 0, + 5, + 5, + 6, + 2, + 6, + 3, + 2, + 1, + 1, + 1, + 1, + 1, + 0, + 9, + 3, + 7, + 0, + 5, + 4, + 4, + 2, + 1, + 7, + 5, + 0, + 6, + 9, + 4, + 1, + 6, + 5, + 8, + 9, + 6, + 0, + 4, + 0, + 8, + 0, + 7, + 1, + 9, + 8, + 4, + 0, + 3, + 8, + 5, + 0, + 9, + 6, + 2, + 4, + 5, + 5, + 4, + 4, + 4, + 3, + 6, + 2, + 9, + 8, + 1, + 2, + 3, + 0, + 9, + 8, + 7, + 8, + 7, + 9, + 9, + 2, + 7, + 2, + 4, + 4, + 2, + 8, + 4, + 9, + 0, + 9, + 1, + 8, + 8, + 8, + 4, + 5, + 8, + 0, + 1, + 5, + 6, + 1, + 6, + 6, + 0, + 9, + 7, + 9, + 1, + 9, + 1, + 3, + 3, + 8, + 7, + 5, + 4, + 9, + 9, + 2, + 0, + 0, + 5, + 2, + 4, + 0, + 6, + 3, + 6, + 8, + 9, + 9, + 1, + 2, + 5, + 6, + 0, + 7, + 1, + 7, + 6, + 0, + 6, + 0, + 5, + 8, + 8, + 6, + 1, + 1, + 6, + 4, + 6, + 7, + 1, + 0, + 9, + 4, + 0, + 5, + 0, + 7, + 7, + 5, + 4, + 1, + 0, + 0, + 2, + 2, + 5, + 6, + 9, + 8, + 3, + 1, + 5, + 5, + 2, + 0, + 0, + 0, + 5, + 5, + 9, + 3, + 5, + 7, + 2, + 9, + 7, + 2, + 5, + 7, + 1, + 6, + 3, + 6, + 2, + 6, + 9, + 5, + 6, + 1, + 8, + 8, + 2, + 6, + 7, + 0, + 4, + 2, + 8, + 2, + 5, + 2, + 4, + 8, + 3, + 6, + 0, + 0, + 8, + 2, + 3, + 2, + 5, + 7, + 5, + 3, + 0, + 4, + 2, + 0, + 7, + 5, + 2, + 9, + 6, + 3, + 4, + 5, + 0 + ]; + let len = n; - let prod = 1, max = 1; - while (len < thousandDigits.length){ + let prod = 1, + max = 1; + while (len < thousandDigits.length) { prod = 1; - + //Looping and computing products of n numbers - for (let i = len-n; i < len; i++){ - prod*= thousandDigits[i]; + for (let i = len - n; i < len; i++) { + prod *= thousandDigits[i]; } if (prod > max) max = prod; len++; @@ -37,6 +1045,8 @@ function largestProductinaSeries(n) { console.log(largestProductinaSeries(13)); ``` -### References: +#### Relevant Links - [Sliding Window Technique](https://www.geeksforgeeks.org/window-sliding-technique/) + +
\ No newline at end of file diff --git a/guide/english/certifications/coding-interview-prep/project-euler/problem-9-special-pythagorean-triplet/index.md b/guide/english/certifications/coding-interview-prep/project-euler/problem-9-special-pythagorean-triplet/index.md index 29b7f9ad26..c2b5405c53 100644 --- a/guide/english/certifications/coding-interview-prep/project-euler/problem-9-special-pythagorean-triplet/index.md +++ b/guide/english/certifications/coding-interview-prep/project-euler/problem-9-special-pythagorean-triplet/index.md @@ -1,32 +1,39 @@ --- title: Special Pythagorean triplet --- -## Problem 9: Special Pythagorean triplet +# Problem 9: Special Pythagorean triplet -### Method: +--- +## Problem Explanation - In this challenge we need to find the pythagorean triple. - We have the following information - `a < b < c` - Based on this, we can make a loop starting from `a = 0` and `b = a` since `a < b` always. - We also know that `a + b + c = n` and `a^2 + b^2 = c^2`, since we have `a`, `b` and `n`. We can find `c` and see if it satisfies the triplet theorem. -### Solution: + +--- +## Solutions +
Solution 1 (Click to Show/Hide) + ```js function specialPythagoreanTriplet(n) { let sumOfabc = n; - for (let a = 1; a < n; a++){ - for (let b = a; b < n; b++){ - let c = n - a- b; - if (c > 0){ - if (c**2 == a**2 + b**2){ - return a*b*c; + for (let a = 1; a < n; a++) { + for (let b = a; b < n; b++) { + let c = n - a - b; + if (c > 0) { + if (c ** 2 == a ** 2 + b ** 2) { + return a * b * c; } } } - } + } } specialPythagoreanTriplet(1000); ``` -### References: +#### Relevant Links - [Wikipedia](https://en.wikipedia.org/wiki/Pythagorean_triple) + +
\ No newline at end of file diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/100-doors/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/100-doors/index.md index 38de9082d6..b6668c3c96 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/100-doors/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/100-doors/index.md @@ -1,7 +1,7 @@ --- title: 100 doors --- -## 100 doors +# 100 doors This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/24-game/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/24-game/index.md index e7cf2b04bc..4acc7c7dbe 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/24-game/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/24-game/index.md @@ -1,7 +1,7 @@ --- title: 24 game --- -## 24 game +# 24 game This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/9-billion-names-of-god-the-integer/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/9-billion-names-of-god-the-integer/index.md index 39b81cc78a..00eef6824a 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/9-billion-names-of-god-the-integer/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/9-billion-names-of-god-the-integer/index.md @@ -1,7 +1,7 @@ --- title: 9 billion names of God the integer --- -## 9 billion names of God the integer +# 9 billion names of God the integer This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/abc-problem/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/abc-problem/index.md index 1abf844f49..fedf0316a8 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/abc-problem/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/abc-problem/index.md @@ -1,7 +1,7 @@ --- title: ABC Problem --- -## ABC Problem +# ABC Problem This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/abundant-deficient-and-perfect-number-classifications/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/abundant-deficient-and-perfect-number-classifications/index.md index 0f95c8d898..6e0b98c142 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/abundant-deficient-and-perfect-number-classifications/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/abundant-deficient-and-perfect-number-classifications/index.md @@ -1,7 +1,7 @@ --- title: Abundant, deficient and perfect number classifications --- -## Abundant, deficient and perfect number classifications +# Abundant, deficient and perfect number classifications This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/accumulator-factory/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/accumulator-factory/index.md index f68aca2652..1495cc399a 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/accumulator-factory/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/accumulator-factory/index.md @@ -1,7 +1,7 @@ --- title: Accumulator factory --- -## Accumulator factory +# Accumulator factory This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/ackermann-function/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/ackermann-function/index.md index 89be998b50..7408596300 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/ackermann-function/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/ackermann-function/index.md @@ -1,7 +1,7 @@ --- title: Ackermann function --- -## Ackermann function +# Ackermann function This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/align-columns/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/align-columns/index.md index b490bff5ce..521a34f057 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/align-columns/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/align-columns/index.md @@ -1,7 +1,7 @@ --- title: Align columns --- -## Align columns +# Align columns This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/amicable-pairs/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/amicable-pairs/index.md index 4d70315781..eaa23b15c9 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/amicable-pairs/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/amicable-pairs/index.md @@ -1,7 +1,7 @@ --- title: Amicable pairs --- -## Amicable pairs +# Amicable pairs This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/averagesmode/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/averagesmode/index.md index db2b2cc618..367c71abab 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/averagesmode/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/averagesmode/index.md @@ -1,7 +1,7 @@ --- title: Averages/Mode --- -## Averages/Mode +# Averages/Mode This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/averagespythagorean-means/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/averagespythagorean-means/index.md index a9663e19d9..2fc800451a 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/averagespythagorean-means/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/averagespythagorean-means/index.md @@ -1,7 +1,7 @@ --- title: Averages/Pythagorean means --- -## Averages/Pythagorean means +# Averages/Pythagorean means This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/averagesroot-mean-square/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/averagesroot-mean-square/index.md index cf6ab21e7f..f97d1daa23 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/averagesroot-mean-square/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/averagesroot-mean-square/index.md @@ -1,7 +1,7 @@ --- title: Averages/Root mean square --- -## Averages/Root mean square +# Averages/Root mean square This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/babbage-problem/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/babbage-problem/index.md index aa3074f65f..1776a94326 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/babbage-problem/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/babbage-problem/index.md @@ -1,7 +1,7 @@ --- title: Babbage problem --- -## Babbage problem +# Babbage problem This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/balanced-brackets/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/balanced-brackets/index.md index 44baf2342f..24c498c172 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/balanced-brackets/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/balanced-brackets/index.md @@ -1,25 +1,24 @@ --- title: Balanced brackets --- -## Balanced brackets +# Balanced brackets -This is a stub. Help our community expand it. -This quick style guide will help ensure your pull request gets accepted. +--- +## Solutions - +
### Solution #1 (Click to Show/Hide) -### Basic Solution ```js function isBalanced(str) { - if (str === '') return true; + if (str === "") return true; - str = str.split(''); + str = str.split(""); let stack = []; for (let i = 0; i < str.length; i++) { - if (str[i] === '[') { - stack.push('['); - } else if (str[i] === ']' && stack[stack.length - 1] === '[') { + if (str[i] === "[") { + stack.push("["); + } else if (str[i] === "]" && stack[stack.length - 1] === "[") { stack.pop(); } } @@ -32,3 +31,5 @@ function isBalanced(str) { - Push every `[` into a stack. - Check if the item stored on the stack is `[` when a `]` occurs. This makes it a pair & `[` can be removed from the stack. - The brackets are balanced if there is no item present in the stack. + +
\ No newline at end of file diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/circles-of-given-radius-through-two-points/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/circles-of-given-radius-through-two-points/index.md index 7a80dbf0c7..3ce682f32a 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/circles-of-given-radius-through-two-points/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/circles-of-given-radius-through-two-points/index.md @@ -1,7 +1,7 @@ --- title: Circles of given radius through two points --- -## Circles of given radius through two points +# Circles of given radius through two points This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/closest-pair-problem/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/closest-pair-problem/index.md index dc2298e888..19257031aa 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/closest-pair-problem/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/closest-pair-problem/index.md @@ -1,7 +1,7 @@ --- title: Closest-pair problem --- -## Closest-pair problem +# Closest-pair problem This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/combinations/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/combinations/index.md index e8893dfeaf..78b63b9e1b 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/combinations/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/combinations/index.md @@ -1,7 +1,7 @@ --- title: Combinations --- -## Combinations +# Combinations This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/comma-quibbling/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/comma-quibbling/index.md index 7256e0354d..e8740340f9 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/comma-quibbling/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/comma-quibbling/index.md @@ -1,7 +1,7 @@ --- title: Comma quibbling --- -## Comma quibbling +# Comma quibbling This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/compare-a-list-of-strings/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/compare-a-list-of-strings/index.md index ba04d3d401..d53a29e63a 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/compare-a-list-of-strings/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/compare-a-list-of-strings/index.md @@ -1,7 +1,7 @@ --- title: Compare a list of strings --- -## Compare a list of strings +# Compare a list of strings This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/convert-seconds-to-compound-duration/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/convert-seconds-to-compound-duration/index.md index e3a1fa9e61..7a19acf692 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/convert-seconds-to-compound-duration/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/convert-seconds-to-compound-duration/index.md @@ -1,7 +1,7 @@ --- title: Convert seconds to compound duration --- -## Convert seconds to compound duration +# Convert seconds to compound duration This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/count-occurrences-of-a-substring/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/count-occurrences-of-a-substring/index.md index e1ed0c80f9..c170176f4e 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/count-occurrences-of-a-substring/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/count-occurrences-of-a-substring/index.md @@ -1,7 +1,7 @@ --- title: Count occurrences of a substring --- -## Count occurrences of a substring +# Count occurrences of a substring This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/count-the-coins/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/count-the-coins/index.md index ea285d2f17..b94a15d598 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/count-the-coins/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/count-the-coins/index.md @@ -1,7 +1,7 @@ --- title: Count the coins --- -## Count the coins +# Count the coins This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/cramers-rule/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/cramers-rule/index.md index 24e07583b1..3c4a2820ac 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/cramers-rule/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/cramers-rule/index.md @@ -1,7 +1,7 @@ --- title: Cramer's rule --- -## Cramer's rule +# Cramer's rule This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/date-format/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/date-format/index.md index 11b7598961..e067b4e516 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/date-format/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/date-format/index.md @@ -1,7 +1,7 @@ --- title: Date format --- -## Date format +# Date format This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/date-manipulation/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/date-manipulation/index.md index 2d24155651..24ac41ff5a 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/date-manipulation/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/date-manipulation/index.md @@ -1,7 +1,7 @@ --- title: Date manipulation --- -## Date manipulation +# Date manipulation This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/day-of-the-week/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/day-of-the-week/index.md index 4bf2cefe95..56aade1f38 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/day-of-the-week/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/day-of-the-week/index.md @@ -1,7 +1,7 @@ --- title: Day of the week --- -## Day of the week +# Day of the week This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/deal-cards-for-freecell/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/deal-cards-for-freecell/index.md index 6d1f4c46f1..41d930b72c 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/deal-cards-for-freecell/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/deal-cards-for-freecell/index.md @@ -1,7 +1,7 @@ --- title: Deal cards for FreeCell --- -## Deal cards for FreeCell +# Deal cards for FreeCell This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/deepcopy/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/deepcopy/index.md index 040f2a12ba..4b6937956a 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/deepcopy/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/deepcopy/index.md @@ -1,7 +1,7 @@ --- title: Deepcopy --- -## Deepcopy +# Deepcopy This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/define-a-primitive-data-type/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/define-a-primitive-data-type/index.md index bb435e9a6d..ed66af0465 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/define-a-primitive-data-type/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/define-a-primitive-data-type/index.md @@ -1,7 +1,7 @@ --- title: Define a primitive data type --- -## Define a primitive data type +# Define a primitive data type This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/department-numbers/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/department-numbers/index.md index e53d8a60df..a56468f548 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/department-numbers/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/department-numbers/index.md @@ -1,7 +1,7 @@ --- title: Department Numbers --- -## Department Numbers +# Department Numbers This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/discordian-date/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/discordian-date/index.md index 672607c769..016aff0100 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/discordian-date/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/discordian-date/index.md @@ -1,7 +1,7 @@ --- title: Discordian date --- -## Discordian date +# Discordian date This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/element-wise-operations/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/element-wise-operations/index.md index aea7b2b9e5..8282d26cd9 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/element-wise-operations/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/element-wise-operations/index.md @@ -1,7 +1,7 @@ --- title: Element-wise operations --- -## Element-wise operations +# Element-wise operations This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/emirp-primes/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/emirp-primes/index.md index 66384cdd5b..dfc9b44b0f 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/emirp-primes/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/emirp-primes/index.md @@ -1,7 +1,7 @@ --- title: Emirp primes --- -## Emirp primes +# Emirp primes This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/entropy/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/entropy/index.md index b21369e867..a9093bd946 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/entropy/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/entropy/index.md @@ -1,7 +1,7 @@ --- title: Entropy --- -## Entropy +# Entropy This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/equilibrium-index/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/equilibrium-index/index.md index 79549ce18b..5e7dd156de 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/equilibrium-index/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/equilibrium-index/index.md @@ -1,7 +1,7 @@ --- title: Equilibrium index --- -## Equilibrium index +# Equilibrium index This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/ethiopian-multiplication/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/ethiopian-multiplication/index.md index 91200689c1..755b129f8b 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/ethiopian-multiplication/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/ethiopian-multiplication/index.md @@ -1,7 +1,7 @@ --- title: Ethiopian multiplication --- -## Ethiopian multiplication +# Ethiopian multiplication This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/euler-method/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/euler-method/index.md index 7b9c0db0d9..7461e4b8c4 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/euler-method/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/euler-method/index.md @@ -1,7 +1,7 @@ --- title: Euler method --- -## Euler method +# Euler method This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/evaluate-binomial-coefficients/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/evaluate-binomial-coefficients/index.md index 91bca707ca..dd7c64e420 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/evaluate-binomial-coefficients/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/evaluate-binomial-coefficients/index.md @@ -1,7 +1,7 @@ --- title: Evaluate binomial coefficients --- -## Evaluate binomial coefficients +# Evaluate binomial coefficients This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/execute-a-markov-algorithm/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/execute-a-markov-algorithm/index.md index bbea119387..fd9e23318f 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/execute-a-markov-algorithm/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/execute-a-markov-algorithm/index.md @@ -1,7 +1,7 @@ --- title: Execute a Markov algorithm --- -## Execute a Markov algorithm +# Execute a Markov algorithm This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/execute-brain/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/execute-brain/index.md index 4b435a37dd..a768be4ab4 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/execute-brain/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/execute-brain/index.md @@ -1,7 +1,7 @@ --- title: Execute Brain**** --- -## Execute Brain**** +# Execute Brain**** This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/extensible-prime-generator/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/extensible-prime-generator/index.md index 73cab8fcbf..9ce5ecbe7d 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/extensible-prime-generator/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/extensible-prime-generator/index.md @@ -1,7 +1,7 @@ --- title: Extensible prime generator --- -## Extensible prime generator +# Extensible prime generator This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/factorial/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/factorial/index.md index 2e60496952..d50513c38b 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/factorial/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/factorial/index.md @@ -1,7 +1,7 @@ --- title: Factorial --- -## Factorial +# Factorial This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/factors-of-a-mersenne-number/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/factors-of-a-mersenne-number/index.md index 091d3879b9..cd9fd109d3 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/factors-of-a-mersenne-number/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/factors-of-a-mersenne-number/index.md @@ -1,7 +1,7 @@ --- title: Factors of a Mersenne number --- -## Factors of a Mersenne number +# Factors of a Mersenne number This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/factors-of-an-integer/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/factors-of-an-integer/index.md index f3abaace3b..febe4c84f0 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/factors-of-an-integer/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/factors-of-an-integer/index.md @@ -1,7 +1,7 @@ --- title: Factors of an integer --- -## Factors of an integer +# Factors of an integer This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/farey-sequence/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/farey-sequence/index.md index eda9574060..dfd21b524b 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/farey-sequence/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/farey-sequence/index.md @@ -1,7 +1,7 @@ --- title: Farey sequence --- -## Farey sequence +# Farey sequence This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/fibonacci-n-step-number-sequences/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/fibonacci-n-step-number-sequences/index.md index c8923db155..12f6895203 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/fibonacci-n-step-number-sequences/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/fibonacci-n-step-number-sequences/index.md @@ -1,7 +1,7 @@ --- title: Fibonacci n-step number sequences --- -## Fibonacci n-step number sequences +# Fibonacci n-step number sequences This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/fibonacci-sequence/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/fibonacci-sequence/index.md index e2c9d48918..0642efd446 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/fibonacci-sequence/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/fibonacci-sequence/index.md @@ -1,7 +1,7 @@ --- title: Fibonacci sequence --- -## Fibonacci sequence +# Fibonacci sequence This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/fibonacci-word/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/fibonacci-word/index.md index a7497cc0ea..9c9205f99b 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/fibonacci-word/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/fibonacci-word/index.md @@ -1,7 +1,7 @@ --- title: Fibonacci word --- -## Fibonacci word +# Fibonacci word This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/fractran/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/fractran/index.md index 76a71d2b76..49de46b7d3 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/fractran/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/fractran/index.md @@ -1,7 +1,7 @@ --- title: Fractran --- -## Fractran +# Fractran This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/gamma-function/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/gamma-function/index.md index b4d30845fc..c91eabac4f 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/gamma-function/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/gamma-function/index.md @@ -1,7 +1,7 @@ --- title: Gamma function --- -## Gamma function +# Gamma function This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/gaussian-elimination/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/gaussian-elimination/index.md index 27941af268..9e75ca6258 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/gaussian-elimination/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/gaussian-elimination/index.md @@ -1,7 +1,7 @@ --- title: Gaussian elimination --- -## Gaussian elimination +# Gaussian elimination This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/general-fizzbuzz/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/general-fizzbuzz/index.md index a2efb88d5f..5aa9d1454d 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/general-fizzbuzz/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/general-fizzbuzz/index.md @@ -1,7 +1,7 @@ --- title: General FizzBuzz --- -## General FizzBuzz +# General FizzBuzz This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/generate-lower-case-ascii-alphabet/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/generate-lower-case-ascii-alphabet/index.md index 0a02c6fd4b..7dbda5aecf 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/generate-lower-case-ascii-alphabet/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/generate-lower-case-ascii-alphabet/index.md @@ -1,7 +1,7 @@ --- title: Generate lower case ASCII alphabet --- -## Generate lower case ASCII alphabet +# Generate lower case ASCII alphabet This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/generatorexponential/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/generatorexponential/index.md index c812e25fdf..3e0273e2e6 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/generatorexponential/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/generatorexponential/index.md @@ -1,7 +1,7 @@ --- title: Generator/Exponential --- -## Generator/Exponential +# Generator/Exponential This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/gray-code/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/gray-code/index.md index 1c4a95b04c..31850f897f 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/gray-code/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/gray-code/index.md @@ -1,7 +1,7 @@ --- title: Gray code --- -## Gray code +# Gray code This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/greatest-common-divisor/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/greatest-common-divisor/index.md index ef69ded3b2..eb3329fb97 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/greatest-common-divisor/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/greatest-common-divisor/index.md @@ -1,7 +1,7 @@ --- title: Greatest common divisor --- -## Greatest common divisor +# Greatest common divisor This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/greatest-subsequential-sum/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/greatest-subsequential-sum/index.md index b5aede1679..9e82290e51 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/greatest-subsequential-sum/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/greatest-subsequential-sum/index.md @@ -1,7 +1,7 @@ --- title: Greatest subsequential sum --- -## Greatest subsequential sum +# Greatest subsequential sum This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/hailstone-sequence/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/hailstone-sequence/index.md index b750e5faa4..4056ff3bd0 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/hailstone-sequence/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/hailstone-sequence/index.md @@ -1,7 +1,7 @@ --- title: Hailstone sequence --- -## Hailstone sequence +# Hailstone sequence This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/happy-numbers/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/happy-numbers/index.md index f150eff5c2..6a3e47f6d1 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/happy-numbers/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/happy-numbers/index.md @@ -1,7 +1,7 @@ --- title: Happy numbers --- -## Happy numbers +# Happy numbers This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/harshad-or-niven-series/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/harshad-or-niven-series/index.md index f4396d082e..5e8b4d6fd8 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/harshad-or-niven-series/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/harshad-or-niven-series/index.md @@ -1,7 +1,7 @@ --- title: Harshad or Niven series --- -## Harshad or Niven series +# Harshad or Niven series This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/hash-from-two-arrays/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/hash-from-two-arrays/index.md index 28ab79d1bd..7c277c94fd 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/hash-from-two-arrays/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/hash-from-two-arrays/index.md @@ -1,7 +1,7 @@ --- title: Hash from two arrays --- -## Hash from two arrays +# Hash from two arrays This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/hash-join/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/hash-join/index.md index 22772eae8b..a13c4372c8 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/hash-join/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/hash-join/index.md @@ -1,7 +1,7 @@ --- title: Hash join --- -## Hash join +# Hash join This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/heronian-triangles/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/heronian-triangles/index.md index 05cf55ed45..6bed7da5be 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/heronian-triangles/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/heronian-triangles/index.md @@ -1,7 +1,7 @@ --- title: Heronian triangles --- -## Heronian triangles +# Heronian triangles This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/hofstadter-figure-figure-sequences/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/hofstadter-figure-figure-sequences/index.md index 882fefcec4..173096fd73 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/hofstadter-figure-figure-sequences/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/hofstadter-figure-figure-sequences/index.md @@ -1,7 +1,7 @@ --- title: Hofstadter Figure-Figure sequences --- -## Hofstadter Figure-Figure sequences +# Hofstadter Figure-Figure sequences This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/hofstadter-q-sequence/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/hofstadter-q-sequence/index.md index a8aec35b82..c9ff86168e 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/hofstadter-q-sequence/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/hofstadter-q-sequence/index.md @@ -1,7 +1,7 @@ --- title: Hofstadter Q sequence --- -## Hofstadter Q sequence +# Hofstadter Q sequence This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/i-before-e-except-after-c/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/i-before-e-except-after-c/index.md index e9fb5d1712..0f393c9bb1 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/i-before-e-except-after-c/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/i-before-e-except-after-c/index.md @@ -1,7 +1,7 @@ --- title: I before E except after C --- -## I before E except after C +# I before E except after C This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/iban/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/iban/index.md index a21b6f3fdd..667e390e28 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/iban/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/iban/index.md @@ -1,7 +1,7 @@ --- title: IBAN --- -## IBAN +# IBAN This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/identity-matrix/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/identity-matrix/index.md index 27d4718a60..bc84f5624b 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/identity-matrix/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/identity-matrix/index.md @@ -1,7 +1,7 @@ --- title: Identity matrix --- -## Identity matrix +# Identity matrix This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/index.md index 9498c322dc..b140b8a1b2 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/index.md @@ -1,7 +1,7 @@ --- title: Rosetta Code --- -## Rosetta Code +# Rosetta Code This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/iterated-digits-squaring/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/iterated-digits-squaring/index.md index 2f6e3fa8d1..8e19a2d2df 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/iterated-digits-squaring/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/iterated-digits-squaring/index.md @@ -1,7 +1,7 @@ --- title: Iterated digits squaring --- -## Iterated digits squaring +# Iterated digits squaring This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/jaro-distance/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/jaro-distance/index.md index 9423b6b413..3e2ade8b1c 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/jaro-distance/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/jaro-distance/index.md @@ -1,7 +1,7 @@ --- title: Jaro distance --- -## Jaro distance +# Jaro distance This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/jortsort/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/jortsort/index.md index 9eec17a8db..074feaad0b 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/jortsort/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/jortsort/index.md @@ -1,7 +1,7 @@ --- title: JortSort --- -## JortSort +# JortSort This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/josephus-problem/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/josephus-problem/index.md index 56c8caa868..cf71d156fe 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/josephus-problem/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/josephus-problem/index.md @@ -1,7 +1,7 @@ --- title: Josephus problem --- -## Josephus problem +# Josephus problem This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/s-expressions/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/s-expressions/index.md index e7bc574213..2b2acd2627 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/s-expressions/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/s-expressions/index.md @@ -1,7 +1,7 @@ --- title: S-Expressions --- -## S-Expressions +# S-Expressions This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/sailors-coconuts-and-a-monkey-problem/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/sailors-coconuts-and-a-monkey-problem/index.md index f9d1a3d6d8..34dd94b476 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/sailors-coconuts-and-a-monkey-problem/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/sailors-coconuts-and-a-monkey-problem/index.md @@ -1,7 +1,7 @@ --- title: Sailors, coconuts and a monkey problem --- -## Sailors, coconuts and a monkey problem +# Sailors, coconuts and a monkey problem This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/sedols/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/sedols/index.md index d91c93ed27..6e98dbd67b 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/sedols/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/sedols/index.md @@ -1,7 +1,7 @@ --- title: SEDOLs --- -## SEDOLs +# SEDOLs This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/taxicab-numbers/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/taxicab-numbers/index.md index f7df95386a..02b1d57f3a 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/taxicab-numbers/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/taxicab-numbers/index.md @@ -1,7 +1,7 @@ --- title: Taxicab numbers --- -## Taxicab numbers +# Taxicab numbers This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/tokenize-a-string-with-escaping/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/tokenize-a-string-with-escaping/index.md index 9a00c2321f..3b80026303 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/tokenize-a-string-with-escaping/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/tokenize-a-string-with-escaping/index.md @@ -1,7 +1,7 @@ --- title: Tokenize a string with escaping --- -## Tokenize a string with escaping +# Tokenize a string with escaping This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/top-rank-per-group/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/top-rank-per-group/index.md index 934d7a3679..a527d32fb8 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/top-rank-per-group/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/top-rank-per-group/index.md @@ -1,7 +1,7 @@ --- title: Top rank per group --- -## Top rank per group +# Top rank per group This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/topological-sort/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/topological-sort/index.md index 2fd8b5e8ff..c4b7b732a0 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/topological-sort/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/topological-sort/index.md @@ -1,7 +1,7 @@ --- title: Topological sort --- -## Topological sort +# Topological sort This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/towers-of-hanoi/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/towers-of-hanoi/index.md index 36a2d96b01..b127428aa5 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/towers-of-hanoi/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/towers-of-hanoi/index.md @@ -1,7 +1,7 @@ --- title: Towers of Hanoi --- -## Towers of Hanoi +# Towers of Hanoi This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/vector-cross-product/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/vector-cross-product/index.md index cf05235373..75fe5ac3ff 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/vector-cross-product/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/vector-cross-product/index.md @@ -1,7 +1,7 @@ --- title: Vector cross product --- -## Vector cross product +# Vector cross product This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/vector-dot-product/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/vector-dot-product/index.md index af414ae39d..3240a40f0d 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/vector-dot-product/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/vector-dot-product/index.md @@ -1,7 +1,7 @@ --- title: Vector dot product --- -## Vector dot product +# Vector dot product This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/word-wrap/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/word-wrap/index.md index 1c81e51e8c..fe55217283 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/word-wrap/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/word-wrap/index.md @@ -1,7 +1,7 @@ --- title: Word wrap --- -## Word wrap +# Word wrap This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/y-combinator/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/y-combinator/index.md index 264a4a8bd8..92a9013089 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/y-combinator/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/y-combinator/index.md @@ -1,7 +1,7 @@ --- title: Y combinator --- -## Y combinator +# Y combinator This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/zeckendorf-number-representation/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/zeckendorf-number-representation/index.md index 2c2730b21f..b0296e36a2 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/zeckendorf-number-representation/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/zeckendorf-number-representation/index.md @@ -1,7 +1,7 @@ --- title: Zeckendorf number representation --- -## Zeckendorf number representation +# Zeckendorf number representation This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/zhang-suen-thinning-algorithm/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/zhang-suen-thinning-algorithm/index.md index 9a67b8a3f8..2ec309e23b 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/zhang-suen-thinning-algorithm/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/zhang-suen-thinning-algorithm/index.md @@ -1,7 +1,7 @@ --- title: Zhang-Suen thinning algorithm --- -## Zhang-Suen thinning algorithm +# Zhang-Suen thinning algorithm This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/rosetta-code/zig-zag-matrix/index.md b/guide/english/certifications/coding-interview-prep/rosetta-code/zig-zag-matrix/index.md index 0054990899..8856fd93ca 100644 --- a/guide/english/certifications/coding-interview-prep/rosetta-code/zig-zag-matrix/index.md +++ b/guide/english/certifications/coding-interview-prep/rosetta-code/zig-zag-matrix/index.md @@ -1,7 +1,7 @@ --- title: Zig-zag matrix --- -## Zig-zag matrix +# Zig-zag matrix This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-camper-leaderboard/index.md b/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-camper-leaderboard/index.md index 688e2bb59e..592c18e19e 100644 --- a/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-camper-leaderboard/index.md +++ b/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-camper-leaderboard/index.md @@ -1,7 +1,7 @@ --- title: Build a Camper Leaderboard --- -## Build a Camper Leaderboard +# Build a Camper Leaderboard This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-light-bright-app/index.md b/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-light-bright-app/index.md index 230a962d8d..83f43fe3ab 100644 --- a/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-light-bright-app/index.md +++ b/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-light-bright-app/index.md @@ -1,7 +1,7 @@ --- title: Build a Light-Bright App --- -## Build a Light-Bright App +# Build a Light-Bright App This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-nightlife-coordination-app/index.md b/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-nightlife-coordination-app/index.md index a5b78c2201..897ddd75ac 100644 --- a/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-nightlife-coordination-app/index.md +++ b/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-nightlife-coordination-app/index.md @@ -1,7 +1,7 @@ --- title: Build a Nightlife Coordination App --- -## Build a Nightlife Coordination App +# Build a Nightlife Coordination App This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-pinterest-clone/index.md b/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-pinterest-clone/index.md index 0aa31a2a7b..d4610bd67f 100644 --- a/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-pinterest-clone/index.md +++ b/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-pinterest-clone/index.md @@ -1,7 +1,7 @@ --- title: Build a Pinterest Clone --- -## Build a Pinterest Clone +# Build a Pinterest Clone This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-pong-game/index.md b/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-pong-game/index.md index 92cad29892..fe07b4a227 100644 --- a/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-pong-game/index.md +++ b/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-pong-game/index.md @@ -1,7 +1,7 @@ --- title: Build a Pong Game --- -## Build a Pong Game +# Build a Pong Game This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-recipe-box/index.md b/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-recipe-box/index.md index afd86e24ee..1b51538835 100644 --- a/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-recipe-box/index.md +++ b/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-recipe-box/index.md @@ -1,7 +1,7 @@ --- title: Build a Recipe Box --- -## Build a Recipe Box +# Build a Recipe Box This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-roguelike-dungeon-crawler-game/index.md b/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-roguelike-dungeon-crawler-game/index.md index 511ca5f326..3182cce950 100644 --- a/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-roguelike-dungeon-crawler-game/index.md +++ b/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-roguelike-dungeon-crawler-game/index.md @@ -1,7 +1,7 @@ --- title: Build a Roguelike Dungeon Crawler Game --- -## Build a Roguelike Dungeon Crawler Game +# Build a Roguelike Dungeon Crawler Game This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-simon-game/index.md b/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-simon-game/index.md index 7e762330b1..a1e5238710 100644 --- a/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-simon-game/index.md +++ b/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-simon-game/index.md @@ -1,7 +1,7 @@ --- title: Build a Simon Game --- -## Build a Simon Game +# Build a Simon Game This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-tic-tac-toe-game/index.md b/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-tic-tac-toe-game/index.md index a1a977e7e8..14b194bbba 100644 --- a/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-tic-tac-toe-game/index.md +++ b/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-tic-tac-toe-game/index.md @@ -1,7 +1,7 @@ --- title: Build a Tic Tac Toe Game --- -## Build a Tic Tac Toe Game +# Build a Tic Tac Toe Game This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-voting-app/index.md b/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-voting-app/index.md index fb828bb3ed..e1f8000af0 100644 --- a/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-voting-app/index.md +++ b/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-voting-app/index.md @@ -1,7 +1,7 @@ --- title: Build a Voting App --- -## Build a Voting App +# Build a Voting App This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-wikipedia-viewer/index.md b/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-wikipedia-viewer/index.md index b20c67dc37..0c58fc0131 100644 --- a/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-wikipedia-viewer/index.md +++ b/guide/english/certifications/coding-interview-prep/take-home-projects/build-a-wikipedia-viewer/index.md @@ -1,7 +1,7 @@ --- title: Build a Wikipedia Viewer --- -## Build a Wikipedia Viewer +# Build a Wikipedia Viewer This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/take-home-projects/build-an-image-search-abstraction-layer/index.md b/guide/english/certifications/coding-interview-prep/take-home-projects/build-an-image-search-abstraction-layer/index.md index 9679fd464a..6b53e05f56 100644 --- a/guide/english/certifications/coding-interview-prep/take-home-projects/build-an-image-search-abstraction-layer/index.md +++ b/guide/english/certifications/coding-interview-prep/take-home-projects/build-an-image-search-abstraction-layer/index.md @@ -1,7 +1,7 @@ --- title: Build an Image Search Abstraction Layer --- -## Build an Image Search Abstraction Layer +# Build an Image Search Abstraction Layer This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/take-home-projects/build-the-game-of-life/index.md b/guide/english/certifications/coding-interview-prep/take-home-projects/build-the-game-of-life/index.md index 33eb63e940..407920fc18 100644 --- a/guide/english/certifications/coding-interview-prep/take-home-projects/build-the-game-of-life/index.md +++ b/guide/english/certifications/coding-interview-prep/take-home-projects/build-the-game-of-life/index.md @@ -1,7 +1,7 @@ --- title: Build the Game of Life --- -## Build the Game of Life +# Build the Game of Life This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/take-home-projects/chart-the-stock-market/index.md b/guide/english/certifications/coding-interview-prep/take-home-projects/chart-the-stock-market/index.md index 3f825d5487..b802497ebf 100644 --- a/guide/english/certifications/coding-interview-prep/take-home-projects/chart-the-stock-market/index.md +++ b/guide/english/certifications/coding-interview-prep/take-home-projects/chart-the-stock-market/index.md @@ -1,7 +1,7 @@ --- title: Chart the Stock Market --- -## Chart the Stock Market +# Chart the Stock Market This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/take-home-projects/index.md b/guide/english/certifications/coding-interview-prep/take-home-projects/index.md index 0da23050a1..d3a0d0c4b3 100644 --- a/guide/english/certifications/coding-interview-prep/take-home-projects/index.md +++ b/guide/english/certifications/coding-interview-prep/take-home-projects/index.md @@ -1,7 +1,7 @@ --- title: Take Home Projects --- -## Take Home Projects +# Take Home Projects This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/take-home-projects/manage-a-book-trading-club/index.md b/guide/english/certifications/coding-interview-prep/take-home-projects/manage-a-book-trading-club/index.md index dbcc34e614..d40a1e3757 100644 --- a/guide/english/certifications/coding-interview-prep/take-home-projects/manage-a-book-trading-club/index.md +++ b/guide/english/certifications/coding-interview-prep/take-home-projects/manage-a-book-trading-club/index.md @@ -1,7 +1,7 @@ --- title: Manage a Book Trading Club --- -## Manage a Book Trading Club +# Manage a Book Trading Club This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/take-home-projects/map-data-across-the-globe/index.md b/guide/english/certifications/coding-interview-prep/take-home-projects/map-data-across-the-globe/index.md index 3245759b0d..f4d5e2aeba 100644 --- a/guide/english/certifications/coding-interview-prep/take-home-projects/map-data-across-the-globe/index.md +++ b/guide/english/certifications/coding-interview-prep/take-home-projects/map-data-across-the-globe/index.md @@ -1,7 +1,7 @@ --- title: Map Data Across the Globe --- -## Map Data Across the Globe +# Map Data Across the Globe This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/take-home-projects/p2p-video-chat-application/index.md b/guide/english/certifications/coding-interview-prep/take-home-projects/p2p-video-chat-application/index.md index 0a87289c80..d2fe781fb1 100644 --- a/guide/english/certifications/coding-interview-prep/take-home-projects/p2p-video-chat-application/index.md +++ b/guide/english/certifications/coding-interview-prep/take-home-projects/p2p-video-chat-application/index.md @@ -1,7 +1,7 @@ --- title: P2P Video Chat Application --- -## P2P Video Chat Application +# P2P Video Chat Application This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/take-home-projects/show-national-contiguity-with-a-force-directed-graph/index.md b/guide/english/certifications/coding-interview-prep/take-home-projects/show-national-contiguity-with-a-force-directed-graph/index.md index 1c606c2f53..c18fa65c70 100644 --- a/guide/english/certifications/coding-interview-prep/take-home-projects/show-national-contiguity-with-a-force-directed-graph/index.md +++ b/guide/english/certifications/coding-interview-prep/take-home-projects/show-national-contiguity-with-a-force-directed-graph/index.md @@ -1,7 +1,7 @@ --- title: Show National Contiguity with a Force Directed Graph --- -## Show National Contiguity with a Force Directed Graph +# Show National Contiguity with a Force Directed Graph This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/take-home-projects/show-the-local-weather/index.md b/guide/english/certifications/coding-interview-prep/take-home-projects/show-the-local-weather/index.md index 2a448d37a1..1ddf6cc601 100644 --- a/guide/english/certifications/coding-interview-prep/take-home-projects/show-the-local-weather/index.md +++ b/guide/english/certifications/coding-interview-prep/take-home-projects/show-the-local-weather/index.md @@ -1,7 +1,7 @@ --- title: Show the Local Weather --- -## Show the Local Weather +# Show the Local Weather This is a stub. Help our community expand it. diff --git a/guide/english/certifications/coding-interview-prep/take-home-projects/use-the-twitch-json-api/index.md b/guide/english/certifications/coding-interview-prep/take-home-projects/use-the-twitch-json-api/index.md index ee3bf63493..5683ef2014 100644 --- a/guide/english/certifications/coding-interview-prep/take-home-projects/use-the-twitch-json-api/index.md +++ b/guide/english/certifications/coding-interview-prep/take-home-projects/use-the-twitch-json-api/index.md @@ -1,6 +1,11 @@ --- title: Use the Twitch JSON API --- + +# Use the Twitch JSON API + +--- +## Problem Explanation Update September 29, 2016: Twitch has changed their API and now requires an API key in order to run queries. If you are using CodePen or GitHub pages to build these, we do not recommend adding an API key to your project for security reasons. Instead of using Twitch's API, we recommend hard-coding this JSON into your app as a variable. It is a series of responses for different accounts from Twitch. diff --git a/guide/english/certifications/data-visualization/data-visualization-projects/index.md b/guide/english/certifications/data-visualization/data-visualization-projects/index.md index 03aa6e5ab1..86c9831846 100644 --- a/guide/english/certifications/data-visualization/data-visualization-projects/index.md +++ b/guide/english/certifications/data-visualization/data-visualization-projects/index.md @@ -1,7 +1,7 @@ --- title: Data Visualization Projects --- -## Data Visualization Projects +# Data Visualization Projects This is a stub. Help our community expand it. diff --git a/guide/english/certifications/data-visualization/data-visualization-projects/visualize-data-with-a-bar-chart/index.md b/guide/english/certifications/data-visualization/data-visualization-projects/visualize-data-with-a-bar-chart/index.md index bc66d75560..4c8d30c0b3 100644 --- a/guide/english/certifications/data-visualization/data-visualization-projects/visualize-data-with-a-bar-chart/index.md +++ b/guide/english/certifications/data-visualization/data-visualization-projects/visualize-data-with-a-bar-chart/index.md @@ -1,7 +1,10 @@ --- title: Visualize Data with a Bar Chart --- -## Visualize Data with a Bar Chart +# Visualize Data with a Bar Chart + +--- +## Problem Explanation **Why Visualize Data** Often, just having the data is not enough and can make it harder to understand if it is not visualized. The type of data helps suggest the best way in which to visualize it. Bar charts, for instance, are great in visualizing `categorical` data (data that is not numerical, whose averages do not have any significance) such as the count of how many times a different desserts were bought at a bakery. diff --git a/guide/english/certifications/data-visualization/data-visualization-projects/visualize-data-with-a-choropleth-map/index.md b/guide/english/certifications/data-visualization/data-visualization-projects/visualize-data-with-a-choropleth-map/index.md index cd1bef8d78..d13823944c 100644 --- a/guide/english/certifications/data-visualization/data-visualization-projects/visualize-data-with-a-choropleth-map/index.md +++ b/guide/english/certifications/data-visualization/data-visualization-projects/visualize-data-with-a-choropleth-map/index.md @@ -1,7 +1,7 @@ --- title: Visualize Data with a Choropleth Map --- -## Visualize Data with a Choropleth Map +# Visualize Data with a Choropleth Map This is a stub. Help our community expand it. diff --git a/guide/english/certifications/data-visualization/data-visualization-projects/visualize-data-with-a-heat-map/index.md b/guide/english/certifications/data-visualization/data-visualization-projects/visualize-data-with-a-heat-map/index.md index 7063d22e1f..78762faa11 100644 --- a/guide/english/certifications/data-visualization/data-visualization-projects/visualize-data-with-a-heat-map/index.md +++ b/guide/english/certifications/data-visualization/data-visualization-projects/visualize-data-with-a-heat-map/index.md @@ -1,7 +1,7 @@ --- title: Visualize Data with a Heat Map --- -## Visualize Data with a Heat Map +# Visualize Data with a Heat Map This is a stub. Help our community expand it. diff --git a/guide/english/certifications/data-visualization/data-visualization-projects/visualize-data-with-a-scatterplot-graph/index.md b/guide/english/certifications/data-visualization/data-visualization-projects/visualize-data-with-a-scatterplot-graph/index.md index 81e0329e23..a1148031e4 100644 --- a/guide/english/certifications/data-visualization/data-visualization-projects/visualize-data-with-a-scatterplot-graph/index.md +++ b/guide/english/certifications/data-visualization/data-visualization-projects/visualize-data-with-a-scatterplot-graph/index.md @@ -1,10 +1,10 @@ --- title: Visualize Data with a Scatterplot Graph --- -## Visualize Data with a Scatterplot Graph +# Visualize Data with a Scatterplot Graph - - +--- +## Problem Explanation **The Use of a Scatterplot Graph** diff --git a/guide/english/certifications/data-visualization/data-visualization-projects/visualize-data-with-a-treemap-diagram/index.md b/guide/english/certifications/data-visualization/data-visualization-projects/visualize-data-with-a-treemap-diagram/index.md index a439991cdf..9f03ef2682 100644 --- a/guide/english/certifications/data-visualization/data-visualization-projects/visualize-data-with-a-treemap-diagram/index.md +++ b/guide/english/certifications/data-visualization/data-visualization-projects/visualize-data-with-a-treemap-diagram/index.md @@ -1,7 +1,7 @@ --- title: Visualize Data with a Treemap Diagram --- -## Visualize Data with a Treemap Diagram +# Visualize Data with a Treemap Diagram This is a stub. Help our community expand it. diff --git a/guide/english/certifications/data-visualization/data-visualization-with-d3/add-a-hover-effect-to-a-d3-element/index.md b/guide/english/certifications/data-visualization/data-visualization-with-d3/add-a-hover-effect-to-a-d3-element/index.md index 165a7fdab5..b407d19968 100644 --- a/guide/english/certifications/data-visualization/data-visualization-with-d3/add-a-hover-effect-to-a-d3-element/index.md +++ b/guide/english/certifications/data-visualization/data-visualization-with-d3/add-a-hover-effect-to-a-d3-element/index.md @@ -1,7 +1,11 @@ --- title: Add a Hover Effect to a D3 Element --- -## Add a Hover Effect to a D3 Element +# Add a Hover Effect to a D3 Element + + +--- +## Hints ### Hint 1 @@ -11,10 +15,16 @@ Add the ` bar ` class to all `rect ` elements. Use the ` attr() ` method to add attributes. -### Solution + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) Add the following line of code to the end of your ` rect ` methods chain: ```javascript .attr("class","bar"); ``` + +
\ No newline at end of file diff --git a/guide/english/certifications/data-visualization/data-visualization-with-d3/add-a-tooltip-to-a-d3-element/index.md b/guide/english/certifications/data-visualization/data-visualization-with-d3/add-a-tooltip-to-a-d3-element/index.md index 4bbbd2f616..d1abe2fc9b 100644 --- a/guide/english/certifications/data-visualization/data-visualization-with-d3/add-a-tooltip-to-a-d3-element/index.md +++ b/guide/english/certifications/data-visualization/data-visualization-with-d3/add-a-tooltip-to-a-d3-element/index.md @@ -1,7 +1,11 @@ --- title: Add a Tooltip to a D3 Element --- -## Add a Tooltip to a D3 Element +# Add a Tooltip to a D3 Element + + +--- +## Hints ### Hint 1 @@ -19,7 +23,11 @@ Chain the ` .append() ` and ` .text() ` methods. Use a callback function in the ` .text() ` method. -### Solution + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) Chain the following lines of code with your ` svg.selectAll("rect") ` method. @@ -27,3 +35,4 @@ Chain the following lines of code with your ` svg.selectAll("rect") ` method. .append("title") .text(d=>d); ``` +
diff --git a/guide/english/certifications/data-visualization/data-visualization-with-d3/add-attributes-to-the-circle-elements/index.md b/guide/english/certifications/data-visualization/data-visualization-with-d3/add-attributes-to-the-circle-elements/index.md index 19d9710487..9551459b29 100644 --- a/guide/english/certifications/data-visualization/data-visualization-with-d3/add-attributes-to-the-circle-elements/index.md +++ b/guide/english/certifications/data-visualization/data-visualization-with-d3/add-attributes-to-the-circle-elements/index.md @@ -1,7 +1,7 @@ --- title: Add Attributes to the Circle Elements --- -## Add Attributes to the Circle Elements +# Add Attributes to the Circle Elements This is a stub. Help our community expand it. diff --git a/guide/english/certifications/data-visualization/data-visualization-with-d3/add-axes-to-a-visualization/index.md b/guide/english/certifications/data-visualization/data-visualization-with-d3/add-axes-to-a-visualization/index.md index 448626e8f2..44ecc6f0f4 100644 --- a/guide/english/certifications/data-visualization/data-visualization-with-d3/add-axes-to-a-visualization/index.md +++ b/guide/english/certifications/data-visualization/data-visualization-with-d3/add-axes-to-a-visualization/index.md @@ -1,7 +1,11 @@ --- title: Add Axes to a Visualization --- -## Add Axes to a Visualization +# Add Axes to a Visualization + + +--- +## Hints ### Hint 1 @@ -11,10 +15,12 @@ Set the y-axis variable using `const yAxis = d3.axisLeft(yScale);`. Append the y-axis using `svg.append()`. -### Spoiler Alert | Solution Ahead -### Solution -To solve the challenge, use: +--- +## Solutions + +
Solution 1 (Click to Show/Hide) + ```html ``` +
diff --git a/guide/english/certifications/data-visualization/data-visualization-with-d3/add-classes-with-d3/index.md b/guide/english/certifications/data-visualization/data-visualization-with-d3/add-classes-with-d3/index.md index 6103661c91..0c6d049d8c 100644 --- a/guide/english/certifications/data-visualization/data-visualization-with-d3/add-classes-with-d3/index.md +++ b/guide/english/certifications/data-visualization/data-visualization-with-d3/add-classes-with-d3/index.md @@ -1,7 +1,7 @@ --- title: Add Classes with D3 --- -## Add Classes with D3 +# Add Classes with D3 This is a stub. Help our community expand it. diff --git a/guide/english/certifications/data-visualization/data-visualization-with-d3/add-document-elements-with-d3/index.md b/guide/english/certifications/data-visualization/data-visualization-with-d3/add-document-elements-with-d3/index.md index c7f805ebca..5199c8c431 100644 --- a/guide/english/certifications/data-visualization/data-visualization-with-d3/add-document-elements-with-d3/index.md +++ b/guide/english/certifications/data-visualization/data-visualization-with-d3/add-document-elements-with-d3/index.md @@ -1,10 +1,10 @@ --- title: Add Document Elements with D3 --- -## Add Document Elements with D3 -![:triangular_flag_on_post:](https://forum.freecodecamp.com/images/emoji/emoji_one/triangular_flag_on_post.png?v=3 ":triangular_flag_on_post:") Remember to use **`Read-Search-Ask`** if you get stuck. Try to pair program ![:busts_in_silhouette:](https://forum.freecodecamp.com/images/emoji/emoji_one/busts_in_silhouette.png?v=3 ":busts_in_silhouette:") and write your own code ![:pencil:](https://forum.freecodecamp.com/images/emoji/emoji_one/pencil.png?v=3 ":pencil:") +# Add Document Elements with D3 -### Problem Explanation: +--- +## Problem Explanation This challenge can be completed by referring to the example in the description and modifying the parameters to those that are in the instructions. @@ -15,29 +15,27 @@ From the official D3 Documentation: * [Append](https://github.com/d3/d3-selection/blob/master/README.md#selection_append) * [Text](https://github.com/d3/d3-selection/blob/master/README.md#selection_text) -## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ":speech_balloon:") Hint: 1 + +--- +## Hints + +### Hint 1 * You will need to use `d3` to reference the D3 object and chain your methods -> _try to solve the problem now_ -## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ":speech_balloon:") Hint: 2 +### Hint 2 * To chain methods together, simply start the next one directly after the previous one has ended. The example shows this on separate lines to improve readability. Make sure not to put a semicolon after any of the methods or the code will break. -> _try to solve the problem now_ -## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ":speech_balloon:") Hint: 3 +### Hint 3 * The example shows exactly what is needed, all that needs to be changed are the parameters. E.g. replace 'ul' in the `select` method with 'body'. -> _try to solve the problem now_ -## Spoiler Alert! +
Solution 1 (Click to Show/Hide) -**Solution ahead!** - -## ![:beginner:](https://forum.freecodecamp.com/images/emoji/emoji_one/beginner.png?v=3 ":beginner:") Basic Code Solution: ```javascript ``` + +
\ No newline at end of file diff --git a/guide/english/certifications/data-visualization/data-visualization-with-d3/create-a-linear-scale-with-d3/index.md b/guide/english/certifications/data-visualization/data-visualization-with-d3/create-a-linear-scale-with-d3/index.md index 750aa46481..570a6dcc1c 100644 --- a/guide/english/certifications/data-visualization/data-visualization-with-d3/create-a-linear-scale-with-d3/index.md +++ b/guide/english/certifications/data-visualization/data-visualization-with-d3/create-a-linear-scale-with-d3/index.md @@ -1,10 +1,16 @@ --- title: Create a Linear Scale with D3 --- -## Create a Linear Scale with D3 +# Create a Linear Scale with D3 +--- +## Problem Explanation In this D3 challenge you are required to change the scale variable to create a linear scale. Then set the output variable to the scale called with an input argument of 50. + +--- +## Hints + ### Hint 1 The syntax for creating a scale is: @@ -28,10 +34,14 @@ const output = scale(scalingFactor); ``` Where `scalingFactor` is a number. -### Solution +--- +## Solutions + +
Solution 1 (Click to Show/Hide) To solve this challenge, the `scale` variable has to be re-initialized with a D3 scale ans the scaling factor in the output has to be set to `50`, to do this, change you code to look like this: -```javascript + +```html ``` +
diff --git a/guide/english/certifications/data-visualization/data-visualization-with-d3/create-a-scatterplot-with-svg-circles/index.md b/guide/english/certifications/data-visualization/data-visualization-with-d3/create-a-scatterplot-with-svg-circles/index.md index abc176b197..25d58f76a0 100644 --- a/guide/english/certifications/data-visualization/data-visualization-with-d3/create-a-scatterplot-with-svg-circles/index.md +++ b/guide/english/certifications/data-visualization/data-visualization-with-d3/create-a-scatterplot-with-svg-circles/index.md @@ -1,7 +1,11 @@ --- title: Create a Scatterplot with SVG Circles --- -## Create a Scatterplot with SVG Circles +# Create a Scatterplot with SVG Circles + + +--- +## Hints ### Hint 1 @@ -11,7 +15,11 @@ Use the ` data() `, ` enter() `, and ` append() ` methods. Append circles in the ` append() ` method. -### Solution + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) Chain the following lines of code in the ` svg.selectAll("circle") ` chain: @@ -30,5 +38,5 @@ The ` svg.selectAll("circle") ` chain should look like: .append("circle") ``` -##### Note -The circles won't be visible because we haven't set their attributes yet. We'll do that in the next challenge. +**Note:** The circles won't be visible because we haven't set their attributes yet. We'll do that in the next challenge. +
diff --git a/guide/english/certifications/data-visualization/data-visualization-with-d3/display-shapes-with-svg/index.md b/guide/english/certifications/data-visualization/data-visualization-with-d3/display-shapes-with-svg/index.md index 96b373b8ea..e04c0609a9 100644 --- a/guide/english/certifications/data-visualization/data-visualization-with-d3/display-shapes-with-svg/index.md +++ b/guide/english/certifications/data-visualization/data-visualization-with-d3/display-shapes-with-svg/index.md @@ -1,20 +1,31 @@ --- title: Display Shapes with SVG --- -## Display Shapes with SVG +# Display Shapes with SVG +--- +## Problem Explanation This challenge can be approached in a similar fashion to the previous one; with the difference being that, this time, you must add a specified shape **within** the appended SVG node. SVG supports several shape definitions, but in this instance, we will use **rect**. -## Hint 1 + +--- +## Hints + +### Hint 1 Check that you have appended the **rect** using D3's 'append()' method. (Be sure to enclose **rect** in quotation marks). -## Hint 2 +### Hint 2 Now assign attributes to the shape using D3's '.attr()' method. You can chain multiple uses of this method. Remember when assigning x and y co-ordinates that within the SVG area, point (0,0) occurs on the top-**left**. As such, while x values dictate how far right an element moves, y values will dictate how far **downward** it moves from the origin point. -## Solution (!!Spoiler Alert!!) - ``` + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) + +```html ``` +
diff --git a/guide/english/certifications/data-visualization/data-visualization-with-d3/dynamically-change-the-height-of-each-bar/index.md b/guide/english/certifications/data-visualization/data-visualization-with-d3/dynamically-change-the-height-of-each-bar/index.md index d95fe98566..7f8206c983 100644 --- a/guide/english/certifications/data-visualization/data-visualization-with-d3/dynamically-change-the-height-of-each-bar/index.md +++ b/guide/english/certifications/data-visualization/data-visualization-with-d3/dynamically-change-the-height-of-each-bar/index.md @@ -1,7 +1,7 @@ --- title: Dynamically Change the Height of Each Bar --- -## Dynamically Change the Height of Each Bar +# Dynamically Change the Height of Each Bar This is a stub. Help our community expand it. diff --git a/guide/english/certifications/data-visualization/data-visualization-with-d3/dynamically-set-the-coordinates-for-each-bar/index.md b/guide/english/certifications/data-visualization/data-visualization-with-d3/dynamically-set-the-coordinates-for-each-bar/index.md index 44162ab72a..03d6415478 100644 --- a/guide/english/certifications/data-visualization/data-visualization-with-d3/dynamically-set-the-coordinates-for-each-bar/index.md +++ b/guide/english/certifications/data-visualization/data-visualization-with-d3/dynamically-set-the-coordinates-for-each-bar/index.md @@ -1,7 +1,7 @@ --- title: Dynamically Set the Coordinates for Each Bar --- -## Dynamically Set the Coordinates for Each Bar +# Dynamically Set the Coordinates for Each Bar This is a stub. Help our community expand it. diff --git a/guide/english/certifications/data-visualization/data-visualization-with-d3/index.md b/guide/english/certifications/data-visualization/data-visualization-with-d3/index.md index 659a95fb4a..c32a294e53 100644 --- a/guide/english/certifications/data-visualization/data-visualization-with-d3/index.md +++ b/guide/english/certifications/data-visualization/data-visualization-with-d3/index.md @@ -1,7 +1,7 @@ --- title: Data Visualization with D3 --- -## Data Visualization with D3 +# Data Visualization with D3 D3.js is a JavaScript library for manipulating documents based on data. D3 helps you bring data to life using HTML, SVG, and CSS. D3’s emphasis on web standards gives you the full capabilities of modern browsers without tying yourself to a proprietary framework, combining powerful visualization components and a data-driven approach to DOM manipulation.(Source: [https://d3js.org](https://d3js.org)) diff --git a/guide/english/certifications/data-visualization/data-visualization-with-d3/invert-svg-elements/index.md b/guide/english/certifications/data-visualization/data-visualization-with-d3/invert-svg-elements/index.md index 1de1f3a37d..4b932ae818 100644 --- a/guide/english/certifications/data-visualization/data-visualization-with-d3/invert-svg-elements/index.md +++ b/guide/english/certifications/data-visualization/data-visualization-with-d3/invert-svg-elements/index.md @@ -1,7 +1,7 @@ --- title: Invert SVG Elements --- -## Invert SVG Elements +# Invert SVG Elements This is a stub. Help our community expand it. diff --git a/guide/english/certifications/data-visualization/data-visualization-with-d3/learn-about-svg-in-d3/index.md b/guide/english/certifications/data-visualization/data-visualization-with-d3/learn-about-svg-in-d3/index.md index e7b0c4f002..506d3ec3a2 100644 --- a/guide/english/certifications/data-visualization/data-visualization-with-d3/learn-about-svg-in-d3/index.md +++ b/guide/english/certifications/data-visualization/data-visualization-with-d3/learn-about-svg-in-d3/index.md @@ -1,7 +1,11 @@ --- title: Learn About SVG in D3 --- -## Learn About SVG in D3 +# Learn About SVG in D3 + + +--- +## Hints ### Hint 1 First ensure that you have appended the SVG node to the document body. You can do this using d3's 'append()' - don't forget to enclose "svg" in quotation marks. @@ -9,9 +13,13 @@ First ensure that you have appended the SVG node to the document body. You can d ### Hint 2 To assign CSS properties to the SVG node - in this case 'width' and 'height' - make use of d3's 'attr()'method. You can use the parameters 'w' and 'h' provided, respectively. -### Solution (!!SPOILER ALERT!!) -``` +--- +## Solutions + +
Solution 1 (Click to Show/Hide) + +```html ``` +
diff --git a/guide/english/certifications/front-end-libraries/sass/split-your-styles-into-smaller-chunks-with-partials/index.md b/guide/english/certifications/front-end-libraries/sass/split-your-styles-into-smaller-chunks-with-partials/index.md index bc65eaf2ef..7fcb65a9f6 100644 --- a/guide/english/certifications/front-end-libraries/sass/split-your-styles-into-smaller-chunks-with-partials/index.md +++ b/guide/english/certifications/front-end-libraries/sass/split-your-styles-into-smaller-chunks-with-partials/index.md @@ -1,15 +1,25 @@ --- title: Split Your Styles into Smaller Chunks with Partials --- -## Split Your Styles into Smaller Chunks with Partials +# Split Your Styles into Smaller Chunks with Partials -### Hint + +--- +## Hints + +### Hint 1 Use `@import` -### Solution + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) Use `@import` to import `_variables.scss` like: + ```sass @import 'variables' ``` +
diff --git a/guide/english/certifications/front-end-libraries/sass/store-data-with-sass-variables/index.md b/guide/english/certifications/front-end-libraries/sass/store-data-with-sass-variables/index.md index 3a3533ba97..f098e9d137 100644 --- a/guide/english/certifications/front-end-libraries/sass/store-data-with-sass-variables/index.md +++ b/guide/english/certifications/front-end-libraries/sass/store-data-with-sass-variables/index.md @@ -1,10 +1,15 @@ --- title: Store Data with Sass Variables --- -## Store Data with Sass Variables +# Store Data with Sass Variables -## Solution -```javascript + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) + +```html -``` + + +
\ No newline at end of file diff --git a/guide/english/certifications/front-end-libraries/sass/use-each-to-map-over-items-in-a-list/index.md b/guide/english/certifications/front-end-libraries/sass/use-each-to-map-over-items-in-a-list/index.md index 7ee05ce71d..fce3b11c45 100644 --- a/guide/english/certifications/front-end-libraries/sass/use-each-to-map-over-items-in-a-list/index.md +++ b/guide/english/certifications/front-end-libraries/sass/use-each-to-map-over-items-in-a-list/index.md @@ -1,11 +1,13 @@ --- title: Use @each to Map Over Items in a List --- -## Use @each to Map Over Items in a List +# Use @each to Map Over Items in a List +--- +## Problem Explanation The @each directive loops over a list and for each iteration the variable is assigned the value in the list. -## Example: +**Example:** ```html
``` +
diff --git a/guide/english/certifications/responsive-web-design/applied-visual-design/change-an-elements-relative-position/index.md b/guide/english/certifications/responsive-web-design/applied-visual-design/change-an-elements-relative-position/index.md index f257625ce1..7927ad307e 100644 --- a/guide/english/certifications/responsive-web-design/applied-visual-design/change-an-elements-relative-position/index.md +++ b/guide/english/certifications/responsive-web-design/applied-visual-design/change-an-elements-relative-position/index.md @@ -1,38 +1,34 @@ --- title: Change an Element's Relative Position --- -![:triangular_flag_on_post:](https://forum.freecodecamp.com/images/emoji/emoji_one/triangular_flag_on_post.png?v=3 ":triangular_flag_on_post:") Remember to use **`Read-Search-Ask`** if you get stuck. Try to pair program ![:busts_in_silhouette:](https://forum.freecodecamp.com/images/emoji/emoji_one/busts_in_silhouette.png?v=3 ":busts_in_silhouette:") and write your own code ![:pencil:](https://forum.freecodecamp.com/images/emoji/emoji_one/pencil.png?v=3 ":pencil:") -### ![:checkered_flag:](https://forum.freecodecamp.com/images/emoji/emoji_one/checkered_flag.png?v=3 ":checkered_flag:") Problem Explanation: +# Change an Element's Relative Position -* You need to write a CSS selector which will move all the `h2` elements on the page by `15px` from the top. +--- +## Problem Explanation -## Change an Element's Relative Position +You need to write a CSS selector which will move all the `h2` elements on the page by `15px` from the top. -## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ":speech_balloon:") Hint: 1 + +--- +## Hints + +### Hint 1 Use `position: relative;`. -> _try to solve the problem now_ -## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ":speech_balloon:") Hint: 2 +### Hint 2 Use the `top: ;` property. -> _try to solve the problem now_ -## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ":speech_balloon:") Hint: 3 +### Hint 3 Target the `h2` using `h2{}`. -> _try to solve the problem now_ - -## Spoiler Alert! - -![warning sign](//discourse-user-assets.s3.amazonaws.com/original/2X/2/2d6c412a50797771301e7ceabd554cef4edcd74d.gif) - -**Solution ahead!** +
Solution 1 (Click to Show/Hide) ```html ``` + +
\ No newline at end of file diff --git a/guide/english/certifications/responsive-web-design/applied-visual-design/move-a-relatively-positioned-element-with-css-offsets/index.md b/guide/english/certifications/responsive-web-design/applied-visual-design/move-a-relatively-positioned-element-with-css-offsets/index.md index bcb357adc6..ffe6803207 100644 --- a/guide/english/certifications/responsive-web-design/applied-visual-design/move-a-relatively-positioned-element-with-css-offsets/index.md +++ b/guide/english/certifications/responsive-web-design/applied-visual-design/move-a-relatively-positioned-element-with-css-offsets/index.md @@ -2,29 +2,28 @@ title: Move a Relatively Positioned Element with CSS Offsets --- -![:triangular_flag_on_post:](https://forum.freecodecamp.com/images/emoji/emoji_one/triangular_flag_on_post.png?v=3 ":triangular_flag_on_post:") Remember to use **`Read-Search-Ask`** if you get stuck. Try to pair program ![:busts_in_silhouette:](https://forum.freecodecamp.com/images/emoji/emoji_one/busts_in_silhouette.png?v=3 ":busts_in_silhouette:") and write your own code ![:pencil:](https://forum.freecodecamp.com/images/emoji/emoji_one/pencil.png?v=3 ":pencil:") +# Move a Relatively Positioned Element with CSS Offsets -## Move a Relatively Positioned Element with CSS Offsets -## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ":speech_balloon:") Hint: 1 +--- +## Hints + +### Hint 1 Use the `left` property for offsetting the element right. -> _try to solve the problem now_ -## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ":speech_balloon:") Hint: 2 +### Hint 2 Use the `bottom` property for offsetting the element top. -> _try to solve the problem now_ -## Spoiler Alert! -![warning sign](//discourse-user-assets.s3.amazonaws.com/original/2X/2/2d6c412a50797771301e7ceabd554cef4edcd74d.gif) +--- +## Solutions -**Solution ahead!** +
Solution 1 (Click to Show/Hide) -The following lines of code solves the challenge: ```html ` new class `thick-green-border` with properties: @@ -42,3 +48,5 @@ The final stage is adding this class to image: src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."> ``` + +
\ No newline at end of file diff --git a/guide/english/certifications/responsive-web-design/basic-css/add-different-margins-to-each-side-of-an-element/index.md b/guide/english/certifications/responsive-web-design/basic-css/add-different-margins-to-each-side-of-an-element/index.md index a35ee843e4..f9feb72700 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/add-different-margins-to-each-side-of-an-element/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/add-different-margins-to-each-side-of-an-element/index.md @@ -1,8 +1,10 @@ --- title: Add Different Margins to Each Side of an Element --- -## Add Different Margins to Each Side of an Element +# Add Different Margins to Each Side of an Element +--- +## Problem Explanation To adjust the margins of an element use: ```css diff --git a/guide/english/certifications/responsive-web-design/basic-css/add-different-padding-to-each-side-of-an-element/index.md b/guide/english/certifications/responsive-web-design/basic-css/add-different-padding-to-each-side-of-an-element/index.md index c2955c1cca..db14b33ad8 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/add-different-padding-to-each-side-of-an-element/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/add-different-padding-to-each-side-of-an-element/index.md @@ -1,10 +1,10 @@ --- title: Add Different Padding to Each Side of an Element --- -## Add Different Padding to Each Side of an Element +# Add Different Padding to Each Side of an Element - - +--- +## Problem Explanation To adjust the padding of an element use: diff --git a/guide/english/certifications/responsive-web-design/basic-css/add-rounded-corners-with-border-radius/index.md b/guide/english/certifications/responsive-web-design/basic-css/add-rounded-corners-with-border-radius/index.md index 2944f3dd0c..dcdb49ee83 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/add-rounded-corners-with-border-radius/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/add-rounded-corners-with-border-radius/index.md @@ -1,8 +1,10 @@ --- title: Add Rounded Corners with border-radius --- -## Add Rounded Corners with border-radius +# Add Rounded Corners with border-radius +--- +## Problem Explanation Sometimes you want to have rounded corners instead of square ones. In this case we use the "border-radius" property to determine how rounded we want our corners to be. To adjust the roundness of a corner use: diff --git a/guide/english/certifications/responsive-web-design/basic-css/adjust-the-margin-of-an-element/index.md b/guide/english/certifications/responsive-web-design/basic-css/adjust-the-margin-of-an-element/index.md index 5de2a2c5ce..0d5d0caf12 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/adjust-the-margin-of-an-element/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/adjust-the-margin-of-an-element/index.md @@ -1,8 +1,10 @@ --- title: Adjust the Margin of an Element --- -## Adjust the Margin of an Element +# Adjust the Margin of an Element +--- +## Problem Explanation Adjusting the `Margin` of an `Element` means to increase or decrease the amount of spacing between the Element's borders and surrounding Elements. • Margins are adjusted with positive and negative integers by units of pixels(`px`). diff --git a/guide/english/certifications/responsive-web-design/basic-css/adjust-the-padding-of-an-element/index.md b/guide/english/certifications/responsive-web-design/basic-css/adjust-the-padding-of-an-element/index.md index d63d2a457d..f63814c81b 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/adjust-the-padding-of-an-element/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/adjust-the-padding-of-an-element/index.md @@ -1,8 +1,10 @@ --- title: Adjust the Padding of an Element --- -## Adjust the Padding of an Element +# Adjust the Padding of an Element +--- +## Problem Explanation Padding is the spacing between the content and the border of an Element. •There is spacing from the top, bottom, left, and right. diff --git a/guide/english/certifications/responsive-web-design/basic-css/attach-a-fallback-value-to-a-css-variable/index.md b/guide/english/certifications/responsive-web-design/basic-css/attach-a-fallback-value-to-a-css-variable/index.md index 239d9d53cf..101a246ba7 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/attach-a-fallback-value-to-a-css-variable/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/attach-a-fallback-value-to-a-css-variable/index.md @@ -1,15 +1,20 @@ --- title: Attach a Fallback value to a CSS Variable --- -## Attach a Fallback value to a CSS Variable +# Attach a Fallback value to a CSS Variable - +--- +## Problem Explanation We need to add a fallback value of ```black``` to the ```background``` property of the ```.penguin-top``` and ```.penguin-bottom``` classes. -## Solution + +--- +## Solutions Add a fallback value of ```black``` to the ```background``` property of the ```.penguin-bottom``` class: +
Solution 1 (Click to Show/Hide) + ```js .penguin-bottom { top: 40%; @@ -37,3 +42,5 @@ Add a fallback value of ```black``` to the ```background``` property of the ```. border-radius: 70% 70% 60% 60%; } ``` + +
\ No newline at end of file diff --git a/guide/english/certifications/responsive-web-design/basic-css/cascading-css-variables/index.md b/guide/english/certifications/responsive-web-design/basic-css/cascading-css-variables/index.md index 3dbb58cd35..3e743885f0 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/cascading-css-variables/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/cascading-css-variables/index.md @@ -1,8 +1,10 @@ --- title: Cascading CSS Variables --- -## Cascading CSS Variables +# Cascading CSS Variables +--- +## Problem Explanation Cascading CSS variables (officially called custom properties) are entities which behave similarly to traditional variables, in that variables allow for data to be stored and updated to reflect new values later2. CSS variables are defined to contain specific values and be reused throughout a document. They are set using custom property notation (e.g., `--main-color: black`) and are accessed using the `var()` function (e.g., `color: var(--main-color)`)1. Declare the CSS variable in the `:root` or `body` selectors for global access. @@ -10,7 +12,7 @@ CSS variables are defined to contain specific values and be reused throughout a When maintaining complex CSS documents, it is not only beneficial to use CSS Variables but also smart. When making future updates instead of searching potential hundreds of lines of code, one only needs to update the necessary CSS variable1. -### Syntax +**Example Syntax:** ```css :root { @@ -32,7 +34,12 @@ Using the variable: var(--custom-name) ``` -### Solution + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) + In the ```:root``` selector we need to declare the ```--penguin-belly``` variable and give it the value of ```pink```: @@ -42,7 +49,8 @@ In the ```:root``` selector we need to declare the ```--penguin-belly``` variabl } ``` -### Sources +#### Relevant Links 1. [Visit MDN's Cascading CSS Variables page for more information.](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables) 2. [Perna, Maria Antonietta. "A Practical Guide to CSS Variables (Custom Properties)" *sitepoint*. August 01, 2018. Accessed: October 5, 2018](https://www.sitepoint.com/practical-guide-css-variables-custom-properties/) +
diff --git a/guide/english/certifications/responsive-web-design/basic-css/change-a-variable-for-a-specific-area/index.md b/guide/english/certifications/responsive-web-design/basic-css/change-a-variable-for-a-specific-area/index.md index e7ae063f00..691151c739 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/change-a-variable-for-a-specific-area/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/change-a-variable-for-a-specific-area/index.md @@ -1,14 +1,15 @@ --- title: Change a variable for a specific area --- -## Change a variable for a specific area +# Change a variable for a specific area - +--- +## Problem Explanation Cascading CSS variables officially called custom properties are entities which behave similarly to traditional variables. In that variables allow for data to be stored and updated to reflect new values later. When maintaining complex CSS documents, it is not only beneficial to use CSS Variables but also smart. When making future updates instead of searching potential hundreds of lines of code, one only needs to update the necessary CSS variable. -### Syntax +**Example Syntax:** Declaring the variable: @@ -21,7 +22,11 @@ Using the variable: ```css var(--custom-name) ``` -### Solution + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) We need to reassign the ```--penguin-belly``` variable to ```white``` in the ```penguin``` class: @@ -39,6 +44,7 @@ We need to reassign the ```--penguin-belly``` variable to ```white``` in the ``` } ``` -### Sources +#### Relevant Links 1. [Visit MDN's Cascading CSS Variables page for more information.](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables) 2. [Perna, Maria Antonietta. "A Practical Guide to CSS Variables (Custom Properties)" *sitepoint*. August 01, 2018. Accessed: October 5, 2018](https://www.sitepoint.com/practical-guide-css-variables-custom-properties/) +
diff --git a/guide/english/certifications/responsive-web-design/basic-css/change-the-color-of-text/index.md b/guide/english/certifications/responsive-web-design/basic-css/change-the-color-of-text/index.md index 834e8b7167..27d785443e 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/change-the-color-of-text/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/change-the-color-of-text/index.md @@ -2,21 +2,21 @@ title: Change the Color of Text --- -![:triangular_flag_on_post:](https://forum.freecodecamp.com/images/emoji/emoji_one/triangular_flag_on_post.png?v=3 ":triangular_flag_on_post:") Remember to use **`Read-Search-Ask`** if you get stuck. Try to pair program ![:busts_in_silhouette:](https://forum.freecodecamp.com/images/emoji/emoji_one/busts_in_silhouette.png?v=3 ":busts_in_silhouette:") and write your own code ![:pencil:](https://forum.freecodecamp.com/images/emoji/emoji_one/pencil.png?v=3 ":pencil:") +# Change the Color of Text -## Change the Color of Text -## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ":speech_balloon:") Hint: 1 +--- +## Hints + +### Hint 1 The color of text can be changed using the CSS `color` property. -> _try to solve the problem now_ -## Spoiler Alert! +--- +## Solutions -![warning sign](//discourse-user-assets.s3.amazonaws.com/original/2X/2/2d6c412a50797771301e7ceabd554cef4edcd74d.gif) - -**Solution ahead!** +
Solution 1 (Click to Show/Hide) ```html

CatPhotoApp

@@ -51,3 +51,5 @@ The color of text can be changed using the CSS `color` property. ``` + +
\ No newline at end of file diff --git a/guide/english/certifications/responsive-web-design/basic-css/change-the-font-size-of-an-element/index.md b/guide/english/certifications/responsive-web-design/basic-css/change-the-font-size-of-an-element/index.md index fdf1ac8b0b..6aa9e9d3ec 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/change-the-font-size-of-an-element/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/change-the-font-size-of-an-element/index.md @@ -1,12 +1,13 @@ --- title: Change the Font Size of an Element --- -## Change the Font Size of an Element +# Change the Font Size of an Element - +--- +## Problem Explanation We need to create an entry for ```p``` elements and set the ```font-size``` to 16 pixels (```16px```), Inside the same `````` element: - ```css +```css

Hello World

``` -#### 2. Give all elements on your page the color of ```green``` and font-family of ```monospace``` in our ```body``` element's style declaration: +**Give all elements on your page the color of ```green``` and font-family of ```monospace``` in our ```body``` element's style declaration:** add between ``````: - ```css +```css color: green; font-family: monospace; ``` -#### Full solution +**Full solution** ```css ```:

Hello World

``` + +
\ No newline at end of file diff --git a/guide/english/certifications/responsive-web-design/basic-css/make-circular-images-with-a-border-radius/index.md b/guide/english/certifications/responsive-web-design/basic-css/make-circular-images-with-a-border-radius/index.md index 011038e5e0..0e92cae4b6 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/make-circular-images-with-a-border-radius/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/make-circular-images-with-a-border-radius/index.md @@ -1,12 +1,17 @@ --- title: Make Circular Images with a border-radius --- -## Make Circular Images with a border-radius +# Make Circular Images with a border-radius - +--- +## Problem Explanation We need to give our cat photo a ```border-radius``` of ```50%```. -### Solution + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) In class ```smaller-image``` add a ```border-radius``` of ```50%```: @@ -18,3 +23,5 @@ In class ```smaller-image``` add a ```border-radius``` of ```50%```: ``` This class already assigned to our ```img``` element and making it perfectly circular. + +
\ No newline at end of file diff --git a/guide/english/certifications/responsive-web-design/basic-css/override-all-other-styles-by-using-important/index.md b/guide/english/certifications/responsive-web-design/basic-css/override-all-other-styles-by-using-important/index.md index bf4da86adc..3e4754e5b2 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/override-all-other-styles-by-using-important/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/override-all-other-styles-by-using-important/index.md @@ -1,19 +1,21 @@ --- title: Override All Other Styles by using Important --- -## Override All Other Styles by using Important +# Override All Other Styles by using Important +--- +## Problem Explanation You can override all other styles in CSS by using `!important`. This override is considered the most important and takes precedence over the rest. The list of most important to least important is as follows: -``` + 1. important (!important) 2. inline styles 3. id declarations 4. class declarations -``` + Here is an example of how to write/apply !important: ```css diff --git a/guide/english/certifications/responsive-web-design/basic-css/override-class-declarations-by-styling-id-attributes/index.md b/guide/english/certifications/responsive-web-design/basic-css/override-class-declarations-by-styling-id-attributes/index.md index 7a0d32aff0..a4f2ae05c0 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/override-class-declarations-by-styling-id-attributes/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/override-class-declarations-by-styling-id-attributes/index.md @@ -1,8 +1,10 @@ --- title: Override Class Declarations by Styling ID Attributes --- -## Override Class Declarations by Styling ID Attributes +# Override Class Declarations by Styling ID Attributes +--- +## Problem Explanation In order to understand overriding in CSS, you must first understand the principle of precendence in CSS. The key rule to remember is that CSS is read from the bottom to top. diff --git a/guide/english/certifications/responsive-web-design/basic-css/override-class-declarations-with-inline-styles/index.md b/guide/english/certifications/responsive-web-design/basic-css/override-class-declarations-with-inline-styles/index.md index 394f8401b1..7a32d8166a 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/override-class-declarations-with-inline-styles/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/override-class-declarations-with-inline-styles/index.md @@ -1,12 +1,13 @@ --- title: Override Class Declarations with Inline Styles --- -## Override Class Declarations with Inline Styles +# Override Class Declarations with Inline Styles - +--- +## Problem Explanation We need to use an ```inline style``` to try to make our ```h1``` element white. -### Example +**Example:** Inline styles look like this: @@ -14,7 +15,13 @@ Inline styles look like this:

``` -### Solution +**NOTE:** An inline style loses many of the advantages of a style sheet (by mixing content with presentation). Use this method sparingly. + + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) In this line: @@ -27,5 +34,4 @@ In opening tag ```

``` we need to add ```inline style``` to make our ```h1```

Hello World!

``` -#### Tip: -An inline style loses many of the advantages of a style sheet (by mixing content with presentation). Use this method sparingly. +
\ No newline at end of file diff --git a/guide/english/certifications/responsive-web-design/basic-css/override-styles-in-subsequent-css/index.md b/guide/english/certifications/responsive-web-design/basic-css/override-styles-in-subsequent-css/index.md index f5ed172ddd..faf0e597fa 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/override-styles-in-subsequent-css/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/override-styles-in-subsequent-css/index.md @@ -1,8 +1,10 @@ --- title: Override Styles in Subsequent CSS --- -## Override Styles in Subsequent CSS +# Override Styles in Subsequent CSS +--- +## Problem Explanation The most important bit to remember when wanting to Override Styles in Subsequent CSS is the order the classes are created. The last updated style will take precedent over the previously written classes. diff --git a/guide/english/certifications/responsive-web-design/basic-css/prioritize-one-style-over-another/index.md b/guide/english/certifications/responsive-web-design/basic-css/prioritize-one-style-over-another/index.md index 20852813dc..1f9770b775 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/prioritize-one-style-over-another/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/prioritize-one-style-over-another/index.md @@ -1,14 +1,19 @@ --- title: Prioritize One Style Over Another --- -## Prioritize One Style Over Another +# Prioritize One Style Over Another - +--- +## Problem Explanation We need to create a CSS class called ```pink-text``` that gives an our ```h1``` element the color pink. -### Solution - Between `````` create a class called ```pink-text```: +--- +## Solutions + +
Solution 1 (Click to Show/Hide) + +Between `````` create a class called ```pink-text```: ```css - ``` - And add in this class ```color``` with value of ```pink```: +``` +And add in this class ```color``` with value of ```pink```: - ```css +```css .pink-text { color: pink; } - ``` +``` After, add this class to our ```h1``` element: ```css

Hello World!

``` -### Full solution +**Full solution** ```css

Hello World!

``` +
diff --git a/guide/english/certifications/responsive-web-design/basic-css/set-the-font-family-of-an-element/index.md b/guide/english/certifications/responsive-web-design/basic-css/set-the-font-family-of-an-element/index.md index 0ce16aa59a..d26154f9b5 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/set-the-font-family-of-an-element/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/set-the-font-family-of-an-element/index.md @@ -1,8 +1,10 @@ --- title: Set the Font Family of an Element --- -## Set the Font Family of an Element +# Set the Font Family of an Element +--- +## Problem Explanation In CSS, you can define the type of font used as part of a Font Family. It's recommended to include a set of font types, mostly used for fallback mechanism such that when one Font is not available, the system will fallback to render text using the next available font, and so on. As a rule of thumb, start by providing font family of your choice and end with commonly available fonts such that if the browser is not able to render text using user specified font, then it will use the generic font type as last resort. diff --git a/guide/english/certifications/responsive-web-design/basic-css/set-the-id-of-an-element/index.md b/guide/english/certifications/responsive-web-design/basic-css/set-the-id-of-an-element/index.md index 898356e565..09409fcae5 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/set-the-id-of-an-element/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/set-the-id-of-an-element/index.md @@ -1,7 +1,7 @@ --- title: Set the id of an Element --- -## Set the id of an Element +# Set the id of an Element This is a stub. Help our community expand it. diff --git a/guide/english/certifications/responsive-web-design/basic-css/size-your-images/index.md b/guide/english/certifications/responsive-web-design/basic-css/size-your-images/index.md index 44f54cf3a0..a4ac547bba 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/size-your-images/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/size-your-images/index.md @@ -2,7 +2,10 @@ title: Size Your Images --- -## Size Your Images +# Size Your Images + +--- +## Problem Explanation For sizing your images, first create your class in your style tag. An example: @@ -12,9 +15,9 @@ An example: width: 500px; height: auto; } - ``` +``` - You can then add the class to your image: - ```css +You can then add the class to your image: +```css - ``` +``` diff --git a/guide/english/certifications/responsive-web-design/basic-css/specify-how-fonts-should-degrade/index.md b/guide/english/certifications/responsive-web-design/basic-css/specify-how-fonts-should-degrade/index.md index 299d049925..33ea7f3147 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/specify-how-fonts-should-degrade/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/specify-how-fonts-should-degrade/index.md @@ -1,12 +1,17 @@ --- title: Specify How Fonts Should Degrade --- -## Specify How Fonts Should Degrade +# Specify How Fonts Should Degrade - +--- +## Problem Explanation We need to apply the ```monospace``` font to the ```h2``` element, so that it now has two fonts - ```Lobster``` and ```monospace```. After, we need to comment out that import of the ```Lobster``` font(using the HTML comments you learned before) from Google Fonts so that it isn't available anymore. -### Solution + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) To the property ```font-family``` in selector ```h2```, in addition to ```Lobster``` font we need to add ```monospace```: @@ -27,3 +32,5 @@ select all import and ```ctrl+/```: ```css ``` + +
\ No newline at end of file diff --git a/guide/english/certifications/responsive-web-design/basic-css/style-multiple-elements-with-a-css-class/index.md b/guide/english/certifications/responsive-web-design/basic-css/style-multiple-elements-with-a-css-class/index.md index b0c7833bae..924b65510c 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/style-multiple-elements-with-a-css-class/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/style-multiple-elements-with-a-css-class/index.md @@ -1,11 +1,17 @@ --- title: Style Multiple Elements with a CSS Class --- -## Style Multiple Elements with a CSS Class +# Style Multiple Elements with a CSS Class +--- +## Problem Explanation We need to applying our ```red-text``` class to the first ```p``` element. -### Solution + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) In the opening tag of element ```p``` we need to add ```red-text``` class: @@ -49,6 +55,7 @@ In the opening tag of element ```p``` we need to add ```red-text``` class: ``` -### More information +#### Relevant Links -- [Class selectors](https://developer.mozilla.org/en-US/docs/Web/CSS/Class_selectors) \ No newline at end of file +- [Class selectors](https://developer.mozilla.org/en-US/docs/Web/CSS/Class_selectors) +
\ No newline at end of file diff --git a/guide/english/certifications/responsive-web-design/basic-css/style-the-html-body-element/index.md b/guide/english/certifications/responsive-web-design/basic-css/style-the-html-body-element/index.md index 3d9ce32e6e..518e2343e7 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/style-the-html-body-element/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/style-the-html-body-element/index.md @@ -1,7 +1,7 @@ --- title: Style the HTML Body Element --- -## Style the HTML Body Element +# Style the HTML Body Element This is a stub. Help our community expand it. diff --git a/guide/english/certifications/responsive-web-design/basic-css/understand-absolute-versus-relative-units/index.md b/guide/english/certifications/responsive-web-design/basic-css/understand-absolute-versus-relative-units/index.md index 78db960eea..2099ccf04f 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/understand-absolute-versus-relative-units/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/understand-absolute-versus-relative-units/index.md @@ -1,7 +1,7 @@ --- title: Understand Absolute versus Relative Units --- -## Understand Absolute versus Relative Units +# Understand Absolute versus Relative Units This is a stub. Help our community expand it. diff --git a/guide/english/certifications/responsive-web-design/basic-css/use-a-css-class-to-style-an-element/index.md b/guide/english/certifications/responsive-web-design/basic-css/use-a-css-class-to-style-an-element/index.md index a311cb0a80..81506d93ee 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/use-a-css-class-to-style-an-element/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/use-a-css-class-to-style-an-element/index.md @@ -1,9 +1,10 @@ --- title: Use a CSS Class to Style an Element --- -## Use a CSS Class to Style an Element +# Use a CSS Class to Style an Element - +--- +## Problem Explanation In CSS, we can target the styling of specific elements that match the specified class attribute. diff --git a/guide/english/certifications/responsive-web-design/basic-css/use-a-custom-css-variable/index.md b/guide/english/certifications/responsive-web-design/basic-css/use-a-custom-css-variable/index.md index 9e71ab843a..ad10e9a645 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/use-a-custom-css-variable/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/use-a-custom-css-variable/index.md @@ -1,7 +1,7 @@ --- title: Use a custom CSS Variable --- -## Use a custom CSS Variable +# Use a custom CSS Variable This is a stub. Help our community expand it. diff --git a/guide/english/certifications/responsive-web-design/basic-css/use-a-media-query-to-change-a-variable/index.md b/guide/english/certifications/responsive-web-design/basic-css/use-a-media-query-to-change-a-variable/index.md index c71e13ed83..b59d989bd8 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/use-a-media-query-to-change-a-variable/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/use-a-media-query-to-change-a-variable/index.md @@ -1,7 +1,7 @@ --- title: Use a media query to change a variable --- -## Use a media query to change a variable +# Use a media query to change a variable This is a stub. Help our community expand it. diff --git a/guide/english/certifications/responsive-web-design/basic-css/use-abbreviated-hex-code/index.md b/guide/english/certifications/responsive-web-design/basic-css/use-abbreviated-hex-code/index.md index 210166de8e..3eba651765 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/use-abbreviated-hex-code/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/use-abbreviated-hex-code/index.md @@ -1,7 +1,7 @@ --- title: Use Abbreviated Hex Code --- -## Use Abbreviated Hex Code +# Use Abbreviated Hex Code This is a stub. Help our community expand it. diff --git a/guide/english/certifications/responsive-web-design/basic-css/use-an-id-attribute-to-style-an-element/index.md b/guide/english/certifications/responsive-web-design/basic-css/use-an-id-attribute-to-style-an-element/index.md index 66ca604119..82de6da7d3 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/use-an-id-attribute-to-style-an-element/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/use-an-id-attribute-to-style-an-element/index.md @@ -1,7 +1,7 @@ --- title: Use an id Attribute to Style an Element --- -## Use an id Attribute to Style an Element +# Use an id Attribute to Style an Element This is a stub. Help our community expand it. diff --git a/guide/english/certifications/responsive-web-design/basic-css/use-attribute-selectors-to-style-elements/index.md b/guide/english/certifications/responsive-web-design/basic-css/use-attribute-selectors-to-style-elements/index.md index 685c85bbc5..ce2d3bc6ba 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/use-attribute-selectors-to-style-elements/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/use-attribute-selectors-to-style-elements/index.md @@ -1,28 +1,31 @@ --- title: Use Attribute Selectors to Style Elements --- -## Use Attribute Selectors to Style Elements +# Use Attribute Selectors to Style Elements +--- +## Problem Explanation You can also apply styling to elements by their attribute values. -### For Example +**For Example:** + 1. If you want to style all the checkboxes on the page, you can do. - ``` +``` [type='checkbox'] { // CSS styling } - ``` +``` 2. This also works with custom attribute, lets say you have two elements with attribute named `foo`. - ``` +```

foo bar

foo baz

- ``` +``` You can use attribute to style them differently. - ``` +``` [foo='bar'] { color: red; } [foo='baz'] { color: purple; } - ``` +``` diff --git a/guide/english/certifications/responsive-web-design/basic-css/use-clockwise-notation-to-specify-the-margin-of-an-element/index.md b/guide/english/certifications/responsive-web-design/basic-css/use-clockwise-notation-to-specify-the-margin-of-an-element/index.md index 0dce4647f0..83d52f86b9 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/use-clockwise-notation-to-specify-the-margin-of-an-element/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/use-clockwise-notation-to-specify-the-margin-of-an-element/index.md @@ -1,7 +1,7 @@ --- title: Use Clockwise Notation to Specify the Margin of an Element --- -## Use Clockwise Notation to Specify the Margin of an Element +# Use Clockwise Notation to Specify the Margin of an Element This is a stub. Help our community expand it. diff --git a/guide/english/certifications/responsive-web-design/basic-css/use-clockwise-notation-to-specify-the-padding-of-an-element/index.md b/guide/english/certifications/responsive-web-design/basic-css/use-clockwise-notation-to-specify-the-padding-of-an-element/index.md index 5dbda5515b..39788f365b 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/use-clockwise-notation-to-specify-the-padding-of-an-element/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/use-clockwise-notation-to-specify-the-padding-of-an-element/index.md @@ -1,7 +1,7 @@ --- title: Use Clockwise Notation to Specify the Padding of an Element --- -## Use Clockwise Notation to Specify the Padding of an Element +# Use Clockwise Notation to Specify the Padding of an Element This is a stub. Help our community expand it. diff --git a/guide/english/certifications/responsive-web-design/basic-css/use-css-selectors-to-style-elements/index.md b/guide/english/certifications/responsive-web-design/basic-css/use-css-selectors-to-style-elements/index.md index dea0e23df8..0bc8c5fabf 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/use-css-selectors-to-style-elements/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/use-css-selectors-to-style-elements/index.md @@ -1,8 +1,10 @@ --- title: Use CSS Selectors to Style Elements --- -## Use CSS Selectors to Style Elements +# Use CSS Selectors to Style Elements +--- +## Problem Explanation CSS selectors are widely used to apply styling to all instances of a particular element. To apply the color `purple` to all the `h2`s on the page, you can define the following CSS inside a `` block. diff --git a/guide/english/certifications/responsive-web-design/basic-css/use-css-variables-to-change-several-elements-at-once/index.md b/guide/english/certifications/responsive-web-design/basic-css/use-css-variables-to-change-several-elements-at-once/index.md index 47ff213aa1..a79c849db9 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/use-css-variables-to-change-several-elements-at-once/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/use-css-variables-to-change-several-elements-at-once/index.md @@ -1,7 +1,7 @@ --- title: Use CSS Variables to change several elements at once --- -## Use CSS Variables to change several elements at once +# Use CSS Variables to change several elements at once This is a stub. Help our community expand it. diff --git a/guide/english/certifications/responsive-web-design/basic-css/use-hex-code-for-specific-colors/index.md b/guide/english/certifications/responsive-web-design/basic-css/use-hex-code-for-specific-colors/index.md index 49358be223..96b0bf08df 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/use-hex-code-for-specific-colors/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/use-hex-code-for-specific-colors/index.md @@ -1,7 +1,7 @@ --- title: Use Hex Code for Specific Colors --- -## Use Hex Code for Specific Colors +# Use Hex Code for Specific Colors This is a stub. Help our community expand it. diff --git a/guide/english/certifications/responsive-web-design/basic-css/use-hex-code-to-mix-colors/index.md b/guide/english/certifications/responsive-web-design/basic-css/use-hex-code-to-mix-colors/index.md index f2b71328f4..582a924775 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/use-hex-code-to-mix-colors/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/use-hex-code-to-mix-colors/index.md @@ -1,12 +1,16 @@ --- title: Use Hex Code to Mix Colors --- -## Use Hex Code to Mix Colors +# Use Hex Code to Mix Colors -## Hint + +--- +## Hints + +### Hint 1 In order to change the color of a class within the style element, we simply replace the color itself with the hexcode shown below. -### Before +**Before** ```html ``` -### After +**After** ```html ``` -### Final Solution +**Final Solution** After changing `color` of other classes, the final solution reveals that we have changed the `color` element of these text classes with hex codes shown below: ```html +``` +

diff --git a/guide/english/certifications/responsive-web-design/basic-css/use-rgb-to-mix-colors/index.md b/guide/english/certifications/responsive-web-design/basic-css/use-rgb-to-mix-colors/index.md index 57fd14cc06..02e478504f 100644 --- a/guide/english/certifications/responsive-web-design/basic-css/use-rgb-to-mix-colors/index.md +++ b/guide/english/certifications/responsive-web-design/basic-css/use-rgb-to-mix-colors/index.md @@ -1,27 +1,10 @@ --- title: Use RGB to Mix Colors --- -## Use RGB to Mix Colors +# Use RGB to Mix Colors -## Problem -```html - -``` - -## Objective +--- +## Problem Explanation Within the ` ``` -### After +After ```html ``` -### After changing `color` of class `.red-text` +**After changing `color` of class `.red-text`** ```html ``` -### After changing `color` of other classes +**After changing `color` of other classes** ```html ``` -## Final Solution +**Final Solution** Hence, the final solution reveals that we have changed the `color` element of these text classes with rgb values shown below: ```html + +
+
+
+
+``` +
diff --git a/guide/english/certifications/responsive-web-design/css-grid/add-columns-with-grid-template-columns/index.md b/guide/english/certifications/responsive-web-design/css-grid/add-columns-with-grid-template-columns/index.md index 923455d59d..a70a45dd6c 100644 --- a/guide/english/certifications/responsive-web-design/css-grid/add-columns-with-grid-template-columns/index.md +++ b/guide/english/certifications/responsive-web-design/css-grid/add-columns-with-grid-template-columns/index.md @@ -1,24 +1,36 @@ --- title: Add Columns with grid-template-columns --- -## Add Columns with grid-template-columns +# Add Columns with grid-template-columns +--- +## Problem Explanation In this challenge, you are required to define columns for the grid. -### Hint + +--- +## Hints + +### Hint 1 You can define columns by declaring the following in your CSS codeblock: -````css +```css grid-template-columns: parameters; -```` +``` where parameters is whatever you want it to be. -### Solution + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) Since the challenge requires you to create three columns of 100px each, declare the following in your .container CSS codeblock: -````css +```css grid-template-columns: 100px 100px 100px; -```` +``` + +
\ No newline at end of file diff --git a/guide/english/certifications/responsive-web-design/css-grid/add-gaps-faster-with-grid-gap/index.md b/guide/english/certifications/responsive-web-design/css-grid/add-gaps-faster-with-grid-gap/index.md index 9ae198afa0..d34fec7778 100644 --- a/guide/english/certifications/responsive-web-design/css-grid/add-gaps-faster-with-grid-gap/index.md +++ b/guide/english/certifications/responsive-web-design/css-grid/add-gaps-faster-with-grid-gap/index.md @@ -1,24 +1,36 @@ --- title: Add Gaps Faster with grid-gap --- -## Add Gaps Faster with grid-gap +# Add Gaps Faster with grid-gap +--- +## Problem Explanation In this challenge you are required to use "grid-gap" to define a row gap and a column gap. -### Hint + +--- +## Hints + +### Hint 1 You can define the gap for the row and column by declaring the following in the .container CSS codeblock: -````css +```css grid-gap: 'row-gap' 'column-gap'; -```` +``` and inserting the desired parameters for 'row-gap' and 'column-gap'. -### Solution + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) Since the challenge requires you to create a 10px gap between the rows and a 20px gap between the columns, add the following code to the .container CSS codeblock: -````css +```css grid-gap: 10px 20px; -```` +``` + +
\ No newline at end of file diff --git a/guide/english/certifications/responsive-web-design/css-grid/add-rows-with-grid-template-rows/index.md b/guide/english/certifications/responsive-web-design/css-grid/add-rows-with-grid-template-rows/index.md index 718ac10bab..7ea28b950e 100644 --- a/guide/english/certifications/responsive-web-design/css-grid/add-rows-with-grid-template-rows/index.md +++ b/guide/english/certifications/responsive-web-design/css-grid/add-rows-with-grid-template-rows/index.md @@ -1,18 +1,30 @@ --- title: Add Rows with grid-template-rows --- -## Add Rows with grid-template-rows +# Add Rows with grid-template-rows +--- +## Problem Explanation In this challenge, you are required to define rows for the CSS grid in `
`. -### Hint + +--- +## Hints + +### Hint 1 You can define rows by using the `grid-template-rows` CSS property. -### Solution + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) Since the challenge requires you to create two rows of `50px` each, declare the following in your `.container` CSS code block: -````css +```css grid-template-rows: 50px 50px; -```` +``` + +
\ No newline at end of file diff --git a/guide/english/certifications/responsive-web-design/css-grid/align-all-items-horizontally-using-justify-items/index.md b/guide/english/certifications/responsive-web-design/css-grid/align-all-items-horizontally-using-justify-items/index.md index f7aafa4c16..ac37fd6dc6 100644 --- a/guide/english/certifications/responsive-web-design/css-grid/align-all-items-horizontally-using-justify-items/index.md +++ b/guide/english/certifications/responsive-web-design/css-grid/align-all-items-horizontally-using-justify-items/index.md @@ -1,24 +1,35 @@ --- title: Align All Items Horizontally using justify-items --- -## Align All Items Horizontally using justify-items +# Align All Items Horizontally using justify-items +--- +## Problem Explanation In this challenge you are required to use the "justify-items" property to horizontally align all the items in the grid. -### Hint + +--- +## Hints + +### Hint 1 You can horizontally align the items by declaring the following in your CSS codeblock: -````css +```css justify-items: value; -```` +``` where value is how you would like to horizontally align the items. -### Solution + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) Since the challenge requires you to horizontally center all the items, declare the following in your .container CSS codeblock: -````css +```css justify-items: center; -```` +``` +
diff --git a/guide/english/certifications/responsive-web-design/css-grid/align-all-items-vertically-using-align-items/index.md b/guide/english/certifications/responsive-web-design/css-grid/align-all-items-vertically-using-align-items/index.md index 48ffb43c8a..df108c8ca8 100644 --- a/guide/english/certifications/responsive-web-design/css-grid/align-all-items-vertically-using-align-items/index.md +++ b/guide/english/certifications/responsive-web-design/css-grid/align-all-items-vertically-using-align-items/index.md @@ -1,24 +1,36 @@ --- title: Align All Items Vertically using align-items --- -## Align All Items Vertically using align-items +# Align All Items Vertically using align-items +--- +## Problem Explanation In this challenge you are required to use the "align-items" property to vertically align all the items in the grid. + +--- +## Hints + ### Hint You can vertically align the items by declaring the following in your CSS codeblock: -````css +```css align-items: value; -```` +``` where value is how you could like to vertically align the items. -### Solution + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) Since the challenge requires you to move all the items to the end of each cell (vertically), declare the following in your .container CSS codeblock: -````css +```css align-items: end; -```` +``` + +
\ No newline at end of file diff --git a/guide/english/certifications/responsive-web-design/css-grid/align-an-item-horizontally-using-justify-self/index.md b/guide/english/certifications/responsive-web-design/css-grid/align-an-item-horizontally-using-justify-self/index.md index 65bcca721d..fc003a5a6f 100644 --- a/guide/english/certifications/responsive-web-design/css-grid/align-an-item-horizontally-using-justify-self/index.md +++ b/guide/english/certifications/responsive-web-design/css-grid/align-an-item-horizontally-using-justify-self/index.md @@ -1,24 +1,36 @@ --- title: Align an Item Horizontally using justify-self --- -## Align an Item Horizontally using justify-self +# Align an Item Horizontally using justify-self +--- +## Problem Explanation In this challenge you are required to use the "justify-self" property to horizontally align a grid item. -### Hint + +--- +## Hints + +### Hint 1 You can horizontally align an item by declaring the following in your CSS codeblock: -````css +```css justify-self: value; -```` +``` where value is how you would like to horizontally align the item. -### Solution + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) Since this challenge requires you to (horizontally) center the item with the class `item2`, declare the following in your `.item2` CSS codeblock: -````css +```css justify-self: center; -```` +``` + +
\ No newline at end of file diff --git a/guide/english/certifications/responsive-web-design/css-grid/align-an-item-vertically-using-align-self/index.md b/guide/english/certifications/responsive-web-design/css-grid/align-an-item-vertically-using-align-self/index.md index c70505c386..96549d230e 100644 --- a/guide/english/certifications/responsive-web-design/css-grid/align-an-item-vertically-using-align-self/index.md +++ b/guide/english/certifications/responsive-web-design/css-grid/align-an-item-vertically-using-align-self/index.md @@ -1,24 +1,35 @@ --- title: Align an Item Vertically using align-self --- -## Align an Item Vertically using align-self +# Align an Item Vertically using align-self +--- +## Problem Explanation In this challenge you are required to use the "align-self" property to vertically align a grid item. -### Hint + +--- +## Hints + +### Hint 1 You can vertically align an item by declaring the following in your CSS codeblock: -````css +```css align-self: value; -```` +``` where value is how you would like to vertically align the item. -### Solution + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) Since this challenge requires you to vertically align the item with the class `item3` at the end, declare the following in your `.item3` CSS codeblock: -````css +```css align-self: end; -```` +``` +
diff --git a/guide/english/certifications/responsive-web-design/css-grid/create-a-column-gap-using-grid-column-gap/index.md b/guide/english/certifications/responsive-web-design/css-grid/create-a-column-gap-using-grid-column-gap/index.md index 11a34bba13..a02d83ba90 100644 --- a/guide/english/certifications/responsive-web-design/css-grid/create-a-column-gap-using-grid-column-gap/index.md +++ b/guide/english/certifications/responsive-web-design/css-grid/create-a-column-gap-using-grid-column-gap/index.md @@ -1,24 +1,36 @@ --- title: Create a Column Gap Using grid-column-gap --- -## Create a Column Gap Using grid-column-gap +# Create a Column Gap Using grid-column-gap +--- +## Problem Explanation This challenge requires you to add a gap of 20px between all the columns of the CSS Grid in .container. -### Hint + +--- +## Hints + +### Hint 1 To add the gap between the columns of a grid, we use: -````css +```css grid-column-gap: parameter; -```` +``` where parameter is the required gap. -### Solution + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) Since the challenge has you adding a gap of 20px, you would add the following line to the .container CSS codeblock. -````css +```css grid-column-gap: 20px; -```` +``` + +
\ No newline at end of file diff --git a/guide/english/certifications/responsive-web-design/css-grid/create-a-row-gap-using-grid-row-gap/index.md b/guide/english/certifications/responsive-web-design/css-grid/create-a-row-gap-using-grid-row-gap/index.md index f5ea864402..9ad1f13bbc 100644 --- a/guide/english/certifications/responsive-web-design/css-grid/create-a-row-gap-using-grid-row-gap/index.md +++ b/guide/english/certifications/responsive-web-design/css-grid/create-a-row-gap-using-grid-row-gap/index.md @@ -1,18 +1,30 @@ --- title: Create a Row Gap using grid-row-gap --- -## Create a Row Gap using grid-row-gap +# Create a Row Gap using grid-row-gap +--- +## Problem Explanation This challenge requires you to add a gap of `20px` between all the rows of the CSS Grid in .container. -### Hint + +--- +## Hints + +### Hint 1 To add a gap between the rows in a CSS grid, we use the `grid-row-gap` CSS property. -### Solution + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) Since the challenge has you adding a gap of `5px`, you would add the following line to the `.container` CSS code block. -````css +```css grid-row-gap: 5px; -```` +``` + +
\ No newline at end of file diff --git a/guide/english/certifications/responsive-web-design/css-grid/create-flexible-layouts-using-auto-fill/index.md b/guide/english/certifications/responsive-web-design/css-grid/create-flexible-layouts-using-auto-fill/index.md index 88606aea67..2538fa7379 100644 --- a/guide/english/certifications/responsive-web-design/css-grid/create-flexible-layouts-using-auto-fill/index.md +++ b/guide/english/certifications/responsive-web-design/css-grid/create-flexible-layouts-using-auto-fill/index.md @@ -1,23 +1,27 @@ --- title: Create Flexible Layouts Using auto-fill --- -## Create Flexible Layouts Using auto-fill ## +# Create Flexible Layouts Using auto-fill + +--- +## Problem Explanation This challenge will expound upon the previous challenge by adding the **auto-fill** value to the *repeat* function. This will cause the number of divs to expand based on the viewport's size rather than the previously specified column value. In the **Before** section below, the **grid-template-column** value "3" is specified. *Keep in mind that the following code snippets are only examples and not the exact challege from freeCodeCamp's curriculum.* -### Before ### +**Before** + ```css - grid-template-columns: repeat(3, minmax(50px, 2fr)); +grid-template-columns: repeat(3, minmax(50px, 2fr)); ``` -### After ### +**After** + ```css - grid-template-columns: repeat(auto-fill, minmax(50px, 2fr)); +grid-template-columns: repeat(auto-fill, minmax(50px, 2fr)); ``` ---- -### Resources ### +#### Relevant Links You may refer to the **Syntax** portion of the following page to see the **auto-fill** value: [Mozilla Developer Network](https://developer.mozilla.org/en-US/docs/Web/CSS/repeat) \ No newline at end of file diff --git a/guide/english/certifications/responsive-web-design/css-grid/create-flexible-layouts-using-auto-fit/index.md b/guide/english/certifications/responsive-web-design/css-grid/create-flexible-layouts-using-auto-fit/index.md index e07319dd94..bdb682d744 100644 --- a/guide/english/certifications/responsive-web-design/css-grid/create-flexible-layouts-using-auto-fit/index.md +++ b/guide/english/certifications/responsive-web-design/css-grid/create-flexible-layouts-using-auto-fit/index.md @@ -1,7 +1,7 @@ --- title: Create Flexible Layouts Using auto-fit --- -## Create Flexible Layouts Using auto-fit +# Create Flexible Layouts Using auto-fit This is a stub. Help our community expand it. diff --git a/guide/english/certifications/responsive-web-design/css-grid/create-grids-within-grids/index.md b/guide/english/certifications/responsive-web-design/css-grid/create-grids-within-grids/index.md index 4f3236ac8a..4d07171847 100644 --- a/guide/english/certifications/responsive-web-design/css-grid/create-grids-within-grids/index.md +++ b/guide/english/certifications/responsive-web-design/css-grid/create-grids-within-grids/index.md @@ -1,20 +1,24 @@ --- title: Create Grids within Grids --- -## Create Grids within Grids +# Create Grids within Grids +--- +## Problem Explanation A grid within a grid is made the same as any other grid. 1. Just nest one element inside another, 2. set them *both* to grids, 3. and *POOF*! You have a grid-within-a-grid. -### Nesting an element +**Nesting an element** + For any refreshers, nesting an element looks like this: `
Here is your grid
Here is your nested grid
` -### Setting your elements to grids +**Setting your elements to grids** + After that, adjust the following CSS properties: `.gridElement{ /* this gives you a grid */ @@ -26,6 +30,6 @@ After that, adjust the following CSS properties: display: grid; }` -### Additional Information +** Notes:** After that, feel free to customize your grids however you like. i.e. `grid-template-columns: auto 1fr;` might look good in that nested grid. diff --git a/guide/english/certifications/responsive-web-design/css-grid/create-your-first-css-grid/index.md b/guide/english/certifications/responsive-web-design/css-grid/create-your-first-css-grid/index.md index 1b6f9f3086..9e0129f948 100644 --- a/guide/english/certifications/responsive-web-design/css-grid/create-your-first-css-grid/index.md +++ b/guide/english/certifications/responsive-web-design/css-grid/create-your-first-css-grid/index.md @@ -1,15 +1,19 @@ --- title: Create Your First CSS Grid --- -## Create Your First CSS Grid +# Create Your First CSS Grid + + +--- +## Hints ### Hint 1 To change display of any element, the following syntax is used: -````css +```css display: propertyName; -```` +``` ### Hint 2 @@ -19,10 +23,16 @@ Change the display property of the .container element Set the display of the .container element to grid -### Solution + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) To set the display of the .container element to grid: -````css +```css display: grid; -```` +``` + +
\ No newline at end of file diff --git a/guide/english/certifications/responsive-web-design/css-grid/divide-the-grid-into-an-area-template/index.md b/guide/english/certifications/responsive-web-design/css-grid/divide-the-grid-into-an-area-template/index.md index a6af333257..8b3f9f50e6 100644 --- a/guide/english/certifications/responsive-web-design/css-grid/divide-the-grid-into-an-area-template/index.md +++ b/guide/english/certifications/responsive-web-design/css-grid/divide-the-grid-into-an-area-template/index.md @@ -1,21 +1,33 @@ --- title: Divide the Grid Into an Area Template --- -## Divide the Grid Into an Area Template +# Divide the Grid Into an Area Template +--- +## Problem Explanation In this challenge you are required to use the "grid-template-areas" property to group cells of a grid together into areas and give the areas a custom name. -### Hint + +--- +## Hints + +### Hint 1 A period (`.`) designates an empty cell in a grid. -### Solution + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) Since the challenge requires you to make the cell labeled `advert` into an empty cell, change `advert` to a `.` (period) so that the code reflects the following: -````css +```css grid-template-areas: "header header header" ". content content" "footer footer footer"; -```` +``` + +
\ No newline at end of file diff --git a/guide/english/certifications/responsive-web-design/css-grid/index.md b/guide/english/certifications/responsive-web-design/css-grid/index.md index 170d30132b..0a85286415 100644 --- a/guide/english/certifications/responsive-web-design/css-grid/index.md +++ b/guide/english/certifications/responsive-web-design/css-grid/index.md @@ -1,7 +1,7 @@ --- title: CSS Grid --- -## CSS Grid +# CSS Grid This is a stub. Help our community expand it. @@ -9,6 +9,6 @@ This is a stub. Help our community expand it. diff --git a/guide/english/certifications/responsive-web-design/css-grid/use-css-grid-units-to-change-the-size-of-columns-and-rows/index.md b/guide/english/certifications/responsive-web-design/css-grid/use-css-grid-units-to-change-the-size-of-columns-and-rows/index.md index 706f4a3b2f..6439686952 100644 --- a/guide/english/certifications/responsive-web-design/css-grid/use-css-grid-units-to-change-the-size-of-columns-and-rows/index.md +++ b/guide/english/certifications/responsive-web-design/css-grid/use-css-grid-units-to-change-the-size-of-columns-and-rows/index.md @@ -1,22 +1,33 @@ --- title: Use CSS Grid Units to Change the Size of Columns and Rows --- -## Use CSS Grid units to Change the Size of Columns and Rows +# Use CSS Grid Units to Change the Size of Columns and Rows +--- +## Problem Explanation This challenge requires you to set the width of the columns of the container to the ones as specified in the challenge description. -### Hint + +--- +## Hints + +### Hint 1 Change the `grid-template-columns` property. -### Solution + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) Since the challenge requires you to set the width to `1fr`, `100px`, and `2fr`, change the `css grid-template-columns` property of `.container` to: -````css +```css grid-template-columns: 1fr 100px 2fr; -```` +``` -#### More Infomation +#### Relevant Links * [An Introduction to the fr CSS unit - CSS tricks](https://css-tricks.com/introduction-fr-css-unit/) +
diff --git a/guide/english/certifications/responsive-web-design/css-grid/use-grid-area-without-creating-an-areas-template/index.md b/guide/english/certifications/responsive-web-design/css-grid/use-grid-area-without-creating-an-areas-template/index.md index c9913f8d31..cc7083ab48 100644 --- a/guide/english/certifications/responsive-web-design/css-grid/use-grid-area-without-creating-an-areas-template/index.md +++ b/guide/english/certifications/responsive-web-design/css-grid/use-grid-area-without-creating-an-areas-template/index.md @@ -1,13 +1,21 @@ --- title: Use grid-area Without Creating an Areas Template --- -## Use grid-area Without Creating an Areas Template +# Use grid-area Without Creating an Areas Template -### Hint + +--- +## Hints + +### Hint 1 The `grid-area` takes values in the following format `horizontal line to start at / vertical line to start at / horizontal line to end at / vertical line to end at`. -### Solution + +--- +## Solutions + +
Solution 1 (Click to Show/Hide) ```html ``` + +
\ No newline at end of file diff --git a/guide/english/certifications/responsive-web-design/responsive-web-design-principles/make-typography-responsive/index.md b/guide/english/certifications/responsive-web-design/responsive-web-design-principles/make-typography-responsive/index.md index 8d76c33ae9..1d7f7561fa 100644 --- a/guide/english/certifications/responsive-web-design/responsive-web-design-principles/make-typography-responsive/index.md +++ b/guide/english/certifications/responsive-web-design/responsive-web-design-principles/make-typography-responsive/index.md @@ -2,27 +2,22 @@ title: Make Typography Responsive --- -![:triangular_flag_on_post:](https://forum.freecodecamp.com/images/emoji/emoji_one/triangular_flag_on_post.png?v=3 ":triangular_flag_on_post:") Remember to use **`Read-Search-Ask`** if you get stuck. Try to pair program ![:busts_in_silhouette:](https://forum.freecodecamp.com/images/emoji/emoji_one/busts_in_silhouette.png?v=3 ":busts_in_silhouette:") and write your own code ![:pencil:](https://forum.freecodecamp.com/images/emoji/emoji_one/pencil.png?v=3 ":pencil:") +# Make Typography Responsive -## Make Typography Responsive -## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ":speech_balloon:") Hint: 1 +--- +## Hints + +### Hint 1 For viewport width use the `vw` unit. -> _try to solve the problem now_ -## ![:speech_balloon:](https://forum.freecodecamp.com/images/emoji/emoji_one/speech_balloon.png?v=3 ":speech_balloon:") Hint: 2 +### Hint 2 For the smaller viewport measurement use the `vmin` unit. -> _try to solve the problem now_ - -## Spoiler Alert! - -![warning sign](//discourse-user-assets.s3.amazonaws.com/original/2X/2/2d6c412a50797771301e7ceabd554cef4edcd74d.gif) - -**Solution ahead!** +
Solution 1 (Click to Show/Hide) ```html ``` note that the simplest way to make your images appear "retina" (and optimize them for retina displays) is to define their width and height values as only half of what the original file is. + +
\ No newline at end of file diff --git a/guide/english/certifications/responsive-web-design/responsive-web-design-projects/build-a-personal-portfolio-webpage/index.md b/guide/english/certifications/responsive-web-design/responsive-web-design-projects/build-a-personal-portfolio-webpage/index.md index bc2ba509b4..29c44b3a0a 100644 --- a/guide/english/certifications/responsive-web-design/responsive-web-design-projects/build-a-personal-portfolio-webpage/index.md +++ b/guide/english/certifications/responsive-web-design/responsive-web-design-projects/build-a-personal-portfolio-webpage/index.md @@ -1,7 +1,7 @@ --- title: Build a Personal Portfolio Webpage --- -## Build a Personal Portfolio Webpage +# Build a Personal Portfolio Webpage This is a stub. Help our community expand it. diff --git a/guide/english/certifications/responsive-web-design/responsive-web-design-projects/build-a-product-landing-page/index.md b/guide/english/certifications/responsive-web-design/responsive-web-design-projects/build-a-product-landing-page/index.md index eacfb8087b..370bc8898b 100644 --- a/guide/english/certifications/responsive-web-design/responsive-web-design-projects/build-a-product-landing-page/index.md +++ b/guide/english/certifications/responsive-web-design/responsive-web-design-projects/build-a-product-landing-page/index.md @@ -1,7 +1,7 @@ --- title: Build a Product Landing Page --- -## Build a Product Landing Page +# Build a Product Landing Page This is a stub. Help our community expand it. diff --git a/guide/english/certifications/responsive-web-design/responsive-web-design-projects/build-a-survey-form/index.md b/guide/english/certifications/responsive-web-design/responsive-web-design-projects/build-a-survey-form/index.md index c002b0703e..5fe3c1d1b5 100644 --- a/guide/english/certifications/responsive-web-design/responsive-web-design-projects/build-a-survey-form/index.md +++ b/guide/english/certifications/responsive-web-design/responsive-web-design-projects/build-a-survey-form/index.md @@ -1,7 +1,7 @@ --- title: Build a Survey Form --- -## Build a Survey Form +# Build a Survey Form This is a stub. Help our community expand it. diff --git a/guide/english/certifications/responsive-web-design/responsive-web-design-projects/build-a-technical-documentation-page/index.md b/guide/english/certifications/responsive-web-design/responsive-web-design-projects/build-a-technical-documentation-page/index.md index 7fd287d94b..64d1c57c35 100644 --- a/guide/english/certifications/responsive-web-design/responsive-web-design-projects/build-a-technical-documentation-page/index.md +++ b/guide/english/certifications/responsive-web-design/responsive-web-design-projects/build-a-technical-documentation-page/index.md @@ -1,7 +1,7 @@ --- title: Build a Technical Documentation Page --- -## Build a Technical Documentation Page +# Build a Technical Documentation Page This is a stub. Help our community expand it. diff --git a/guide/english/certifications/responsive-web-design/responsive-web-design-projects/build-a-tribute-page/index.md b/guide/english/certifications/responsive-web-design/responsive-web-design-projects/build-a-tribute-page/index.md index 3a3dfff446..db3d98fb98 100644 --- a/guide/english/certifications/responsive-web-design/responsive-web-design-projects/build-a-tribute-page/index.md +++ b/guide/english/certifications/responsive-web-design/responsive-web-design-projects/build-a-tribute-page/index.md @@ -1,7 +1,7 @@ --- title: Build a Tribute Page --- -## Build a Tribute Page +# Build a Tribute Page This is a stub. Help our community expand it. diff --git a/guide/english/certifications/responsive-web-design/responsive-web-design-projects/index.md b/guide/english/certifications/responsive-web-design/responsive-web-design-projects/index.md index 84f2c5fe24..736e4021bc 100644 --- a/guide/english/certifications/responsive-web-design/responsive-web-design-projects/index.md +++ b/guide/english/certifications/responsive-web-design/responsive-web-design-projects/index.md @@ -1,7 +1,7 @@ --- title: Responsive Web Design Projects --- -## Responsive Web Design Projects +# Responsive Web Design Projects This is a stub. Help our community expand it. @@ -9,5 +9,5 @@ This is a stub.