geeksforgeeks placement questions

Upload: radhika-parik

Post on 05-Jul-2018

228 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/16/2019 GeeksforGeeks placement questions

    1/35

    QuestionGiven an array A[] and a number x, check for pair in A[] with sum as x Majority !ement "ind the #umber $ccurrin% $dd #umber of &imes 'ar%est (um )onti%uous (ubarray "ind the Missin% #umber

    (earch an e!ement in a sorted and pivoted array Mer%e an array of si*e n into another array of si*e m+n Median of two sorted arrays rite a pro%ram to reverse an array -ro%ram for array rotation .eversa! a!%orithm for array rotation /!ock swap a!%orithm for array rotation Maximum sum such that no two e!ements are adjacent 'eaders in an array (ort e!ements by fre0uency 1 (et 2

    )ount 3nversions in an array &wo e!ements whose sum is c!osest to *ero "ind the sma!!est and second sma!!est e!ement in an array )heck for Majority !ement in a sorted array Maximum and minimum of an array usin% minimum number of comparisons (e%re%ate 4s and 2s in an array k !ar%est5or sma!!est6 e!ements in an array 1 added Min 7eap method Maximum di8erence between two e!ements 9nion and 3ntersection of two sorted arrays "!oor and )ei!in% in a sorted array A -roduct Array -u**!e (e%re%ate ven and $dd numbers "ind the two repeatin% e!ements in a %iven array (ort an array of 4s "ind the Minimum !en%th 9nsorted (ubarray "ind dup!icates in $5n6 time and $526 extra space 0ui!ibrium index of an array 'inked 'ist vs Array hich sortin% a!%orithm makes minimum number of memory writes: &urn an ima%e by ;4 de%ree #ext Greater !ement )heck if array e!ements are consecutive 1 Added Method < "ind the sma!!est missin% number )ount the number of occurrences in a sorted array 3nterpo!ation search vs /inary search Given an array arr[] Maximum of a!! subarrays of si*e k 5Added a $5n6 method6 "ind whether an array is subset of another array 1 Added Method < "ind the minimum distance between two numbers

    http://www.geeksforgeeks.org/write-a-c-program-that-given-a-set-a-of-n-numbers-and-another-number-x-determines-whether-or-not-there-exist-two-elements-in-s-whose-sum-is-exactly-x/http://www.geeksforgeeks.org/majority-element/http://www.geeksforgeeks.org/find-the-number-occurring-odd-number-of-times/http://www.geeksforgeeks.org/largest-sum-contiguous-subarray/http://www.geeksforgeeks.org/find-the-missing-number/http://www.geeksforgeeks.org/search-an-element-in-a-sorted-and-pivoted-array/http://www.geeksforgeeks.org/merge-one-array-of-size-n-into-another-one-of-size-mn/http://www.geeksforgeeks.org/median-of-two-sorted-arrays/http://www.geeksforgeeks.org/write-a-program-to-reverse-an-array/http://www.geeksforgeeks.org/array-rotation/http://www.geeksforgeeks.org/program-for-array-rotation-continued-reversal-algorithm/http://www.geeksforgeeks.org/block-swap-algorithm-for-array-rotation/http://www.geeksforgeeks.org/maximum-sum-such-that-no-two-elements-are-adjacent/http://www.geeksforgeeks.org/leaders-in-an-array/http://www.geeksforgeeks.org/sort-elements-by-frequency/http://www.geeksforgeeks.org/counting-inversions/http://www.geeksforgeeks.org/two-elements-whose-sum-is-closest-to-zero/http://www.geeksforgeeks.org/to-find-smallest-and-second-smallest-element-in-an-array/http://www.geeksforgeeks.org/check-for-majority-element-in-a-sorted-array/http://www.geeksforgeeks.org/maximum-and-minimum-in-an-array/http://www.geeksforgeeks.org/segregate-0s-and-1s-in-an-array-by-traversing-array-once/http://www.geeksforgeeks.org/k-largestor-smallest-elements-in-an-array/http://www.geeksforgeeks.org/maximum-difference-between-two-elements/http://www.geeksforgeeks.org/union-and-intersection-of-two-sorted-arrays-2/http://www.geeksforgeeks.org/search-floor-and-ceil-in-a-sorted-array/http://www.geeksforgeeks.org/a-product-array-puzzle/http://www.geeksforgeeks.org/segregate-even-and-odd-numbers/http://www.geeksforgeeks.org/find-the-two-repeating-elements-in-a-given-array/http://www.geeksforgeeks.org/sort-an-array-of-0s-1s-and-2s/http://www.geeksforgeeks.org/minimum-length-unsorted-subarray-sorting-which-makes-the-complete-array-sorted/http://www.geeksforgeeks.org/find-duplicates-in-on-time-and-constant-extra-space/http://www.geeksforgeeks.org/equilibrium-index-of-an-array/http://www.geeksforgeeks.org/linked-list-vs-array/http://www.geeksforgeeks.org/which-sorting-algorithm-makes-minimum-number-of-writes/http://www.geeksforgeeks.org/turn-an-image-by-90-degree/http://www.geeksforgeeks.org/next-greater-element/http://www.geeksforgeeks.org/check-if-array-elements-are-consecutive/http://www.geeksforgeeks.org/find-the-first-missing-number/http://www.geeksforgeeks.org/count-number-of-occurrences-in-a-sorted-array/http://www.geeksforgeeks.org/g-fact-84/http://www.geeksforgeeks.org/given-an-array-arr-find-the-maximum-j-i-such-that-arrj-arri/http://www.geeksforgeeks.org/maximum-of-all-subarrays-of-size-k/http://www.geeksforgeeks.org/find-whether-an-array-is-subset-of-another-array-set-1/http://www.geeksforgeeks.org/find-the-minimum-distance-between-two-numbers/http://www.geeksforgeeks.org/find-the-minimum-distance-between-two-numbers/http://www.geeksforgeeks.org/find-whether-an-array-is-subset-of-another-array-set-1/http://www.geeksforgeeks.org/maximum-of-all-subarrays-of-size-k/http://www.geeksforgeeks.org/given-an-array-arr-find-the-maximum-j-i-such-that-arrj-arri/http://www.geeksforgeeks.org/g-fact-84/http://www.geeksforgeeks.org/count-number-of-occurrences-in-a-sorted-array/http://www.geeksforgeeks.org/find-the-first-missing-number/http://www.geeksforgeeks.org/check-if-array-elements-are-consecutive/http://www.geeksforgeeks.org/next-greater-element/http://www.geeksforgeeks.org/turn-an-image-by-90-degree/http://www.geeksforgeeks.org/which-sorting-algorithm-makes-minimum-number-of-writes/http://www.geeksforgeeks.org/linked-list-vs-array/http://www.geeksforgeeks.org/equilibrium-index-of-an-array/http://www.geeksforgeeks.org/find-duplicates-in-on-time-and-constant-extra-space/http://www.geeksforgeeks.org/minimum-length-unsorted-subarray-sorting-which-makes-the-complete-array-sorted/http://www.geeksforgeeks.org/sort-an-array-of-0s-1s-and-2s/http://www.geeksforgeeks.org/find-the-two-repeating-elements-in-a-given-array/http://www.geeksforgeeks.org/segregate-even-and-odd-numbers/http://www.geeksforgeeks.org/a-product-array-puzzle/http://www.geeksforgeeks.org/search-floor-and-ceil-in-a-sorted-array/http://www.geeksforgeeks.org/union-and-intersection-of-two-sorted-arrays-2/http://www.geeksforgeeks.org/maximum-difference-between-two-elements/http://www.geeksforgeeks.org/k-largestor-smallest-elements-in-an-array/http://www.geeksforgeeks.org/segregate-0s-and-1s-in-an-array-by-traversing-array-once/http://www.geeksforgeeks.org/maximum-and-minimum-in-an-array/http://www.geeksforgeeks.org/check-for-majority-element-in-a-sorted-array/http://www.geeksforgeeks.org/to-find-smallest-and-second-smallest-element-in-an-array/http://www.geeksforgeeks.org/two-elements-whose-sum-is-closest-to-zero/http://www.geeksforgeeks.org/counting-inversions/http://www.geeksforgeeks.org/sort-elements-by-frequency/http://www.geeksforgeeks.org/leaders-in-an-array/http://www.geeksforgeeks.org/maximum-sum-such-that-no-two-elements-are-adjacent/http://www.geeksforgeeks.org/block-swap-algorithm-for-array-rotation/http://www.geeksforgeeks.org/program-for-array-rotation-continued-reversal-algorithm/http://www.geeksforgeeks.org/array-rotation/http://www.geeksforgeeks.org/write-a-program-to-reverse-an-array/http://www.geeksforgeeks.org/median-of-two-sorted-arrays/http://www.geeksforgeeks.org/merge-one-array-of-size-n-into-another-one-of-size-mn/http://www.geeksforgeeks.org/search-an-element-in-a-sorted-and-pivoted-array/http://www.geeksforgeeks.org/find-the-missing-number/http://www.geeksforgeeks.org/largest-sum-contiguous-subarray/http://www.geeksforgeeks.org/find-the-number-occurring-odd-number-of-times/http://www.geeksforgeeks.org/majority-element/http://www.geeksforgeeks.org/write-a-c-program-that-given-a-set-a-of-n-numbers-and-another-number-x-determines-whether-or-not-there-exist-two-elements-in-s-whose-sum-is-exactly-x/

  • 8/16/2019 GeeksforGeeks placement questions

    2/35

    "ind the repeatin% and the missin% 1 Added < new methods Median in a stream of inte%ers 5runnin% inte%ers6 "ind a "ixed -oint in a %iven array Maximum 'en%th /itonic (ubarray "ind the maximum e!ement in an array which is =rst increasin% and then decreasin )ount sma!!er e!ements on ri%ht side

    Minimum number of jumps to reach end 3mp!ement two stacks in an array "ind subarray with %iven sum >ynamic -ro%rammin% 1 (et 2? 5Maximum (um 3ncreasin% (ubse0uence6 'on%est Monotonica!!y 3ncreasin% (ubse0uence (i*e 5# !o% #6 "ind a trip!et that sum to a %iven va!ue "ind the sma!!est positive number missin% from an unsorted array "ind the two numbers with odd occurrences in an unsorted array &he )e!ebrity -rob!em >ynamic -ro%rammin% 1 (et 2@ 5'on%est /itonic (ubse0uence6

    "ind a sorted subse0uence of si*e < in !inear time 'ar%est subarray with e0ua! number of 4s and 2s >ynamic -ro%rammin% 1 (et 2 5-artition prob!em6 Maximum -roduct (ubarray "ind a pair with the %iven di8erence .ep!ace every e!ement with the next %reatest >ynamic -ro%rammin% 1 (et B4 5Maximum 'en%th )hain of -airs6 "ind four e!ements that sum to a %iven va!ue 1 (et 2 5nC< so!ution6 "ind four e!ements that sum to a %iven va!ue 1 (et B 5 $5nCB'o%n6 (o!ution6 (ort a near!y sorted 5or D sorted6 array Maximum circu!ar subarray sum "ind the row with maximum number of 2s Median of two sorted arrays of di8erent si*es (huEe a %iven array )ount the number of possib!e trian%!es 3terative Quick (ort "ind the number of is!ands )onstruction of 'on%est Monotonica!!y 3ncreasin% (ubse0uence 5# !o% #6 "ind the =rst circu!ar tour that visits a!! petro! pumps Arran%e %iven numbers to form the bi%%est number -ancake sortin% A -ancake (ortin% -rob!em &u% of ar >ivide and )on0uer 1 (et < 5Maximum (ubarray (um6 )ountin% (ort Mer%e $ver!appin% 3nterva!s "ind the maximum repeatin% number in $5n6 time and $526 extra space (tock /uy (e!! to Maximi*e -ro=t .earran%e positive and ne%ative numbers in $5n6 time and $526 extra space

    http://www.geeksforgeeks.org/find-a-repeating-and-a-missing-number/http://www.geeksforgeeks.org/median-of-stream-of-integers-running-integers/http://www.geeksforgeeks.org/find-a-fixed-point-in-a-given-array/http://www.geeksforgeeks.org/maximum-length-bitonic-subarray/http://www.geeksforgeeks.org/find-the-maximum-element-in-an-array-which-is-first-increasing-and-then-decreasing/http://www.geeksforgeeks.org/count-smaller-elements-on-right-side/http://www.geeksforgeeks.org/minimum-number-of-jumps-to-reach-end-of-a-given-array/http://www.geeksforgeeks.org/implement-two-stacks-in-an-array/http://www.geeksforgeeks.org/find-subarray-with-given-sum/http://www.geeksforgeeks.org/dynamic-programming-set-14-maximum-sum-increasing-subsequence/http://www.geeksforgeeks.org/longest-monotonically-increasing-subsequence-size-n-log-n/http://www.geeksforgeeks.org/find-a-triplet-that-sum-to-a-given-value/http://www.geeksforgeeks.org/find-the-smallest-positive-number-missing-from-an-unsorted-array/http://www.geeksforgeeks.org/find-the-two-numbers-with-odd-occurences-in-an-unsorted-array/http://www.geeksforgeeks.org/the-celebrity-problem/http://www.geeksforgeeks.org/dynamic-programming-set-15-longest-bitonic-subsequence/http://www.geeksforgeeks.org/find-a-sorted-subsequence-of-size-3-in-linear-time/http://www.geeksforgeeks.org/largest-subarray-with-equal-number-of-0s-and-1s/http://www.geeksforgeeks.org/dynamic-programming-set-18-partition-problem/http://www.geeksforgeeks.org/maximum-product-subarray/http://www.geeksforgeeks.org/find-a-pair-with-the-given-difference/http://www.geeksforgeeks.org/replace-every-element-with-the-greatest-on-right-side/http://www.geeksforgeeks.org/dynamic-programming-set-20-maximum-length-chain-of-pairs/http://www.geeksforgeeks.org/find-four-numbers-with-sum-equal-to-given-sum/http://www.geeksforgeeks.org/find-four-elements-that-sum-to-a-given-value-set-2/http://www.geeksforgeeks.org/nearly-sorted-algorithm/http://www.geeksforgeeks.org/maximum-contiguous-circular-sum/http://www.geeksforgeeks.org/find-the-row-with-maximum-number-1s/http://www.geeksforgeeks.org/median-of-two-sorted-arrays-of-different-sizes/http://www.geeksforgeeks.org/shuffle-a-given-array/http://www.geeksforgeeks.org/find-number-of-triangles-possible/http://www.geeksforgeeks.org/iterative-quick-sort/http://www.geeksforgeeks.org/find-number-of-islands/http://www.geeksforgeeks.org/construction-of-longest-monotonically-increasing-subsequence-n-log-n/http://www.geeksforgeeks.org/find-a-tour-that-visits-all-stations/http://www.geeksforgeeks.org/given-an-array-of-numbers-arrange-the-numbers-to-form-the-biggest-number/http://www.geeksforgeeks.org/pancake-sorting/http://www.geeksforgeeks.org/a-pancake-sorting-question/http://www.geeksforgeeks.org/tug-of-war/http://www.geeksforgeeks.org/divide-and-conquer-maximum-sum-subarray/http://www.geeksforgeeks.org/counting-sort/http://www.geeksforgeeks.org/merging-intervals/http://www.geeksforgeeks.org/find-the-maximum-repeating-number-in-ok-time/http://www.geeksforgeeks.org/stock-buy-sell/http://www.geeksforgeeks.org/rearrange-positive-and-negative-numbers-publish/http://www.geeksforgeeks.org/rearrange-positive-and-negative-numbers-publish/http://www.geeksforgeeks.org/stock-buy-sell/http://www.geeksforgeeks.org/find-the-maximum-repeating-number-in-ok-time/http://www.geeksforgeeks.org/merging-intervals/http://www.geeksforgeeks.org/counting-sort/http://www.geeksforgeeks.org/divide-and-conquer-maximum-sum-subarray/http://www.geeksforgeeks.org/tug-of-war/http://www.geeksforgeeks.org/a-pancake-sorting-question/http://www.geeksforgeeks.org/pancake-sorting/http://www.geeksforgeeks.org/given-an-array-of-numbers-arrange-the-numbers-to-form-the-biggest-number/http://www.geeksforgeeks.org/find-a-tour-that-visits-all-stations/http://www.geeksforgeeks.org/construction-of-longest-monotonically-increasing-subsequence-n-log-n/http://www.geeksforgeeks.org/find-number-of-islands/http://www.geeksforgeeks.org/iterative-quick-sort/http://www.geeksforgeeks.org/find-number-of-triangles-possible/http://www.geeksforgeeks.org/shuffle-a-given-array/http://www.geeksforgeeks.org/median-of-two-sorted-arrays-of-different-sizes/http://www.geeksforgeeks.org/find-the-row-with-maximum-number-1s/http://www.geeksforgeeks.org/maximum-contiguous-circular-sum/http://www.geeksforgeeks.org/nearly-sorted-algorithm/http://www.geeksforgeeks.org/find-four-elements-that-sum-to-a-given-value-set-2/http://www.geeksforgeeks.org/find-four-numbers-with-sum-equal-to-given-sum/http://www.geeksforgeeks.org/dynamic-programming-set-20-maximum-length-chain-of-pairs/http://www.geeksforgeeks.org/replace-every-element-with-the-greatest-on-right-side/http://www.geeksforgeeks.org/find-a-pair-with-the-given-difference/http://www.geeksforgeeks.org/maximum-product-subarray/http://www.geeksforgeeks.org/dynamic-programming-set-18-partition-problem/http://www.geeksforgeeks.org/largest-subarray-with-equal-number-of-0s-and-1s/http://www.geeksforgeeks.org/find-a-sorted-subsequence-of-size-3-in-linear-time/http://www.geeksforgeeks.org/dynamic-programming-set-15-longest-bitonic-subsequence/http://www.geeksforgeeks.org/the-celebrity-problem/http://www.geeksforgeeks.org/find-the-two-numbers-with-odd-occurences-in-an-unsorted-array/http://www.geeksforgeeks.org/find-the-smallest-positive-number-missing-from-an-unsorted-array/http://www.geeksforgeeks.org/find-a-triplet-that-sum-to-a-given-value/http://www.geeksforgeeks.org/longest-monotonically-increasing-subsequence-size-n-log-n/http://www.geeksforgeeks.org/dynamic-programming-set-14-maximum-sum-increasing-subsequence/http://www.geeksforgeeks.org/find-subarray-with-given-sum/http://www.geeksforgeeks.org/implement-two-stacks-in-an-array/http://www.geeksforgeeks.org/minimum-number-of-jumps-to-reach-end-of-a-given-array/http://www.geeksforgeeks.org/count-smaller-elements-on-right-side/http://www.geeksforgeeks.org/find-the-maximum-element-in-an-array-which-is-first-increasing-and-then-decreasing/http://www.geeksforgeeks.org/maximum-length-bitonic-subarray/http://www.geeksforgeeks.org/find-a-fixed-point-in-a-given-array/http://www.geeksforgeeks.org/median-of-stream-of-integers-running-integers/http://www.geeksforgeeks.org/find-a-repeating-and-a-missing-number/

  • 8/16/2019 GeeksforGeeks placement questions

    3/35

    (ort e!ements by fre0uency 1 (et B "ind a peak e!ement -rint a!! possib!e combinations of r e!ements in a %iven array of si*e n Given an array of of si*e n and a number k =nd a!! e!ements that appear more than nFk times "ind the point where a monotonica!!y increasin% function becomes positive =rst tim

    "ind the 3ncreasin% subse0uence of !en%th three with maximum product "ind the minimum e!ement in a sorted and rotated array (tab!e Marria%e -rob!em Mer%e k sorted arrays 1 (et 2 .adix (ort Move a!! *eroes to end of array "ind number of pairs such that xCy yCx )ount a!! distinct pairs with di8erence e0ua! to k "ind if there is a subarray with 4 sum (ma!!est subarray with sum %reater than a %iven va!ue

    (ort an array accordin% to the order de=ned by another array Maximum (um -ath in &wo Arrays Qui* on Array

    http://www.geeksforgeeks.org/sort-elements-by-frequency-set-2/http://www.geeksforgeeks.org/find-a-peak-in-a-given-array/http://www.geeksforgeeks.org/print-all-possible-combinations-of-r-elements-in-a-given-array-of-size-n/http://www.geeksforgeeks.org/given-an-array-of-of-size-n-finds-all-the-elements-that-appear-more-than-nk-times/http://www.geeksforgeeks.org/given-an-array-of-of-size-n-finds-all-the-elements-that-appear-more-than-nk-times/http://www.geeksforgeeks.org/find-the-point-where-a-function-becomes-negative/http://www.geeksforgeeks.org/increasing-subsequence-of-length-three-with-maximum-product/http://www.geeksforgeeks.org/find-minimum-element-in-a-sorted-and-rotated-array/http://www.geeksforgeeks.org/stable-marriage-problem/http://www.geeksforgeeks.org/merge-k-sorted-arrays/http://www.geeksforgeeks.org/radix-sort/http://www.geeksforgeeks.org/move-zeroes-end-array/http://www.geeksforgeeks.org/find-number-pairs-xy-yx/http://www.geeksforgeeks.org/count-pairs-difference-equal-k/http://www.geeksforgeeks.org/find-if-there-is-a-subarray-with-0-sum/http://www.geeksforgeeks.org/minimum-length-subarray-sum-greater-given-value/http://www.geeksforgeeks.org/sort-array-according-order-defined-another-array/http://www.geeksforgeeks.org/maximum-sum-path-across-two-arrays/http://geeksquiz.com/data-structure/array/http://geeksquiz.com/data-structure/array/http://www.geeksforgeeks.org/maximum-sum-path-across-two-arrays/http://www.geeksforgeeks.org/sort-array-according-order-defined-another-array/http://www.geeksforgeeks.org/minimum-length-subarray-sum-greater-given-value/http://www.geeksforgeeks.org/find-if-there-is-a-subarray-with-0-sum/http://www.geeksforgeeks.org/count-pairs-difference-equal-k/http://www.geeksforgeeks.org/find-number-pairs-xy-yx/http://www.geeksforgeeks.org/move-zeroes-end-array/http://www.geeksforgeeks.org/radix-sort/http://www.geeksforgeeks.org/merge-k-sorted-arrays/http://www.geeksforgeeks.org/stable-marriage-problem/http://www.geeksforgeeks.org/find-minimum-element-in-a-sorted-and-rotated-array/http://www.geeksforgeeks.org/increasing-subsequence-of-length-three-with-maximum-product/http://www.geeksforgeeks.org/find-the-point-where-a-function-becomes-negative/http://www.geeksforgeeks.org/given-an-array-of-of-size-n-finds-all-the-elements-that-appear-more-than-nk-times/http://www.geeksforgeeks.org/given-an-array-of-of-size-n-finds-all-the-elements-that-appear-more-than-nk-times/http://www.geeksforgeeks.org/print-all-possible-combinations-of-r-elements-in-a-given-array-of-size-n/http://www.geeksforgeeks.org/find-a-peak-in-a-given-array/http://www.geeksforgeeks.org/sort-elements-by-frequency-set-2/

  • 8/16/2019 GeeksforGeeks placement questions

    4/35

    (tatus )ommentsddddd

    ddd #ot %ettin% the fee! of itdddd

    > 'ook at hashin% so!n a%ain

    > Mer%e sort pi%%yback> (ort, indices r and !, if sum +ive> Deep track of =rst and second

    Mer%e types, in pairs> B ptrs and swap

    di8 btwn curr and min, store di8 Mer%e a!%o'inear search or bin searchDeep !eft and ri%ht arraystraverse from !eft and ri%htIIswap

    #>>IIimp see a%ainabs method

    d !eft and ri%ht sumndnddd stackdd /in search of each e!e, traverse id /in serach =rst and !ast occurrenndd B arrays, !min and rmaxd ba!anced /(&d sort and bin search, sort and merd traverse keep prev which is eithe

  • 8/16/2019 GeeksforGeeks placement questions

    5/35

    d xor method, make each index ned 3nsertion sortd /im search

    d /in searchnd

    > dpdd

    d

    d

    dd

    d

  • 8/16/2019 GeeksforGeeks placement questions

    6/35

    e

    http://www.geeksforgeeks.org/find-the-point-where-a-function-becomes-negative/http://www.geeksforgeeks.org/find-the-point-where-a-function-becomes-negative/

  • 8/16/2019 GeeksforGeeks placement questions

    7/35

    &/>

    Ju%%!in% method::

    HH, if sum Hve !++

    Max sum subarray

    accK$. method>o after sortin%

    !eft method <!eft method <e

    !eft 0ueue methode type processx or y

  • 8/16/2019 GeeksforGeeks placement questions

    8/35

    ative, sort and traverseheap method !eft3mp

    read se!f ba!ancin% trees

  • 8/16/2019 GeeksforGeeks placement questions

    9/35

  • 8/16/2019 GeeksforGeeks placement questions

    10/35

    Question3ntroduction to 'inked 'ist 'inked 'ist vs Array 'inked 'ist 3nsertion 'inked 'ist >e!etion A -ro%rammerLs approach of !ookin% at Array vsI 'inked 'ist

    7ow to write ) functions that modify head pointer of a 'inked 'ist: rite a function to %et #th node in a 'inked 'ist Given on!y a pointer to a node to be de!eted in a sin%!y !inked !ist ,-rint the midd!e of a %iven !inked !ist #th node from the end of a 'inked 'ist rite a function to de!ete a 'inked 'ist rite a function that counts the number of times a %iven int occurs in a 'inked 'ist .everse a !inked !ist >etect !oop in a !inked !ist "unction to check if a sin%!y !inked !ist is pa!indrome

    Given a !inked !ist which is sorted 3ntersection point of two 'inked 'istsI .ecursive function to print reverse of a 'inked 'ist .emove dup!icates from a sorted !inked !ist .emove dup!icates from an unsorted !inked !ist -airwise swap e!ements of a %iven !inked !ist -ractice 0uestions for 'inked 'ist and .ecursion Move !ast e!ement to front of a %iven 'inked 'ist 3ntersection of two (orted 'inked 'ists >e!ete a!ternate nodes of a 'inked 'ist A!ternatin% sp!it of a %iven (in%!y 'inked 'ist Mer%e two sorted !inked !ists 3dentica! 'inked 'ists Mer%e (ort for 'inked 'ists .everse a 'inked 'ist in %roups of %iven si*e .everse a!ternate D nodes in a (in%!y 'inked 'ist >e!ete nodes which have a %reater va!ue on ri%ht side (e%re%ate even and odd nodes in a 'inked 'ist >etect and .emove 'oop in a 'inked 'ist Add two numbers represented by !inked !ists 1 (et 2 >e!ete a %iven node in 'inked 'ist under %iven constraints9nion and 3ntersection of two 'inked 'ists "ind a trip!et from three !inked !ists with sum e0ua! to a %iven number .otate a 'inked 'ist "!attenin% a 'inked 'ist Add two numbers represented by !inked !ists 1 (et B (ort a !inked !ist of 4s 2s and Bs "!atten a mu!ti!eve! !inked !ist

    http://geeksquiz.com/linked-list-set-1-introduction/http://www.geeksforgeeks.org/linked-list-vs-array/http://geeksquiz.com/linked-list-set-2-inserting-a-node/http://geeksquiz.com/linked-list-set-3-deleting-node/http://geeksquiz.com/programmers-approach-looking-array-vs-linked-list/http://www.geeksforgeeks.org/how-to-write-functions-that-modify-the-head-pointer-of-a-linked-list/http://www.geeksforgeeks.org/write-a-function-to-get-nth-node-in-a-linked-list/http://www.geeksforgeeks.org/given-only-a-pointer-to-a-node-to-be-deleted-in-a-singly-linked-list-how-do-you-delete-it/http://www.geeksforgeeks.org/write-a-c-function-to-print-the-middle-of-the-linked-list/http://www.geeksforgeeks.org/nth-node-from-the-end-of-a-linked-list/http://www.geeksforgeeks.org/write-a-function-to-delete-a-linked-list/http://www.geeksforgeeks.org/write-a-function-that-counts-the-number-of-times-a-given-int-occurs-in-a-linked-list/http://www.geeksforgeeks.org/write-a-function-to-reverse-the-nodes-of-a-linked-list/http://www.geeksforgeeks.org/write-a-c-function-to-detect-loop-in-a-linked-list/http://www.geeksforgeeks.org/function-to-check-if-a-singly-linked-list-is-palindrome/http://www.geeksforgeeks.org/given-a-linked-list-which-is-sorted-how-will-you-insert-in-sorted-way/http://www.geeksforgeeks.org/write-a-function-to-get-the-intersection-point-of-two-linked-lists/http://www.geeksforgeeks.org/write-a-recursive-function-to-print-reverse-of-a-linked-list/http://www.geeksforgeeks.org/remove-duplicates-from-a-sorted-linked-list/http://www.geeksforgeeks.org/remove-duplicates-from-an-unsorted-linked-list/http://www.geeksforgeeks.org/pairwise-swap-elements-of-a-given-linked-list/http://www.geeksforgeeks.org/practice-questions-for-linked-list-and-recursion/http://www.geeksforgeeks.org/move-last-element-to-front-of-a-given-linked-list/http://www.geeksforgeeks.org/intersection-of-two-sorted-linked-lists/http://www.geeksforgeeks.org/delete-alternate-nodes-of-a-linked-list/http://www.geeksforgeeks.org/alternating-split-of-a-given-singly-linked-list/http://www.geeksforgeeks.org/merge-two-sorted-linked-lists/http://www.geeksforgeeks.org/identical-linked-lists/http://www.geeksforgeeks.org/merge-sort-for-linked-list/http://www.geeksforgeeks.org/reverse-a-list-in-groups-of-given-size/http://www.geeksforgeeks.org/reverse-alternate-k-nodes-in-a-singly-linked-list/http://www.geeksforgeeks.org/delete-nodes-which-have-a-greater-value-on-right-side/http://www.geeksforgeeks.org/segregate-even-and-odd-elements-in-a-linked-list/http://www.geeksforgeeks.org/detect-and-remove-loop-in-a-linked-list/http://www.geeksforgeeks.org/add-two-numbers-represented-by-linked-lists/http://www.geeksforgeeks.org/delete-a-given-node-in-linked-list-under-given-constraints/http://www.geeksforgeeks.org/union-and-intersection-of-two-linked-lists/http://www.geeksforgeeks.org/find-a-triplet-from-three-linked-lists-with-sum-equal-to-a-given-number/http://www.geeksforgeeks.org/rotate-a-linked-list/http://www.geeksforgeeks.org/flattening-a-linked-list/http://www.geeksforgeeks.org/sum-of-two-linked-lists/http://www.geeksforgeeks.org/sort-a-linked-list-of-0s-1s-or-2s/http://www.geeksforgeeks.org/sort-a-linked-list-of-0s-1s-or-2s/http://www.geeksforgeeks.org/flatten-a-linked-list-with-next-and-child-pointers/http://www.geeksforgeeks.org/flatten-a-linked-list-with-next-and-child-pointers/http://www.geeksforgeeks.org/sort-a-linked-list-of-0s-1s-or-2s/http://www.geeksforgeeks.org/sort-a-linked-list-of-0s-1s-or-2s/http://www.geeksforgeeks.org/sum-of-two-linked-lists/http://www.geeksforgeeks.org/flattening-a-linked-list/http://www.geeksforgeeks.org/rotate-a-linked-list/http://www.geeksforgeeks.org/find-a-triplet-from-three-linked-lists-with-sum-equal-to-a-given-number/http://www.geeksforgeeks.org/union-and-intersection-of-two-linked-lists/http://www.geeksforgeeks.org/delete-a-given-node-in-linked-list-under-given-constraints/http://www.geeksforgeeks.org/add-two-numbers-represented-by-linked-lists/http://www.geeksforgeeks.org/detect-and-remove-loop-in-a-linked-list/http://www.geeksforgeeks.org/segregate-even-and-odd-elements-in-a-linked-list/http://www.geeksforgeeks.org/delete-nodes-which-have-a-greater-value-on-right-side/http://www.geeksforgeeks.org/reverse-alternate-k-nodes-in-a-singly-linked-list/http://www.geeksforgeeks.org/reverse-a-list-in-groups-of-given-size/http://www.geeksforgeeks.org/merge-sort-for-linked-list/http://www.geeksforgeeks.org/identical-linked-lists/http://www.geeksforgeeks.org/merge-two-sorted-linked-lists/http://www.geeksforgeeks.org/alternating-split-of-a-given-singly-linked-list/http://www.geeksforgeeks.org/delete-alternate-nodes-of-a-linked-list/http://www.geeksforgeeks.org/intersection-of-two-sorted-linked-lists/http://www.geeksforgeeks.org/move-last-element-to-front-of-a-given-linked-list/http://www.geeksforgeeks.org/practice-questions-for-linked-list-and-recursion/http://www.geeksforgeeks.org/pairwise-swap-elements-of-a-given-linked-list/http://www.geeksforgeeks.org/remove-duplicates-from-an-unsorted-linked-list/http://www.geeksforgeeks.org/remove-duplicates-from-a-sorted-linked-list/http://www.geeksforgeeks.org/write-a-recursive-function-to-print-reverse-of-a-linked-list/http://www.geeksforgeeks.org/write-a-function-to-get-the-intersection-point-of-two-linked-lists/http://www.geeksforgeeks.org/given-a-linked-list-which-is-sorted-how-will-you-insert-in-sorted-way/http://www.geeksforgeeks.org/function-to-check-if-a-singly-linked-list-is-palindrome/http://www.geeksforgeeks.org/write-a-c-function-to-detect-loop-in-a-linked-list/http://www.geeksforgeeks.org/write-a-function-to-reverse-the-nodes-of-a-linked-list/http://www.geeksforgeeks.org/write-a-function-that-counts-the-number-of-times-a-given-int-occurs-in-a-linked-list/http://www.geeksforgeeks.org/write-a-function-to-delete-a-linked-list/http://www.geeksforgeeks.org/nth-node-from-the-end-of-a-linked-list/http://www.geeksforgeeks.org/write-a-c-function-to-print-the-middle-of-the-linked-list/http://www.geeksforgeeks.org/given-only-a-pointer-to-a-node-to-be-deleted-in-a-singly-linked-list-how-do-you-delete-it/http://www.geeksforgeeks.org/write-a-function-to-get-nth-node-in-a-linked-list/http://www.geeksforgeeks.org/how-to-write-functions-that-modify-the-head-pointer-of-a-linked-list/http://geeksquiz.com/programmers-approach-looking-array-vs-linked-list/http://geeksquiz.com/linked-list-set-3-deleting-node/http://geeksquiz.com/linked-list-set-2-inserting-a-node/http://www.geeksforgeeks.org/linked-list-vs-array/http://geeksquiz.com/linked-list-set-1-introduction/

  • 8/16/2019 GeeksforGeeks placement questions

    11/35

    >e!ete # nodes after M nodes of a !inked !ist Quick(ort on (in%!y 'inked 'ist Mer%e a !inked !ist into another !inked !ist at a!ternate positions -airwise swap e!ements of a %iven !inked !ist by chan%in% !inks)ircu!ar 'inked 'ist )ircu!ar 'inked 'ist 3ntroduction and App!ications

    )ircu!ar 'inked 'ist &raversa! (p!it a )ircu!ar 'inked 'ist into two ha!ves (orted insert for circu!ar !inked !ist>oub!y 'inked 'ist >oub!y 'inked 'ist 3ntroduction and 3nsertion >e!ete a node in a >oub!y 'inked 'ist.everse a >oub!y 'inked 'ist

    &he Great &reeH'ist .ecursion -rob!emI )opy a !inked !ist with next and arbit pointer Quick(ort on >oub!y 'inked 'ist (wap Dth node from be%innin% with Dth node from end in a 'inked 'ist

    Qui* on 'inked 'ist

    http://www.geeksforgeeks.org/delete-n-nodes-after-m-nodes-of-a-linked-list/http://www.geeksforgeeks.org/quicksort-on-singly-linked-list/http://www.geeksforgeeks.org/merge-a-linked-list-into-another-linked-list-at-alternate-positions/http://www.geeksforgeeks.org/pairwise-swap-elements-of-a-given-linked-list-by-changing-links/http://geeksquiz.com/circular-linked-list/http://geeksquiz.com/circular-linked-list-set-2-traversal/http://www.geeksforgeeks.org/split-a-circular-linked-list-into-two-halves/http://www.geeksforgeeks.org/sorted-insert-for-circular-linked-list/http://geeksquiz.com/doubly-linked-list/http://www.geeksforgeeks.org/delete-a-node-in-a-doubly-linked-list/http://www.geeksforgeeks.org/reverse-a-doubly-linked-list/http://www.geeksforgeeks.org/the-great-tree-list-recursion-problem/http://www.geeksforgeeks.org/a-linked-list-with-next-and-arbit-pointer/http://www.geeksforgeeks.org/quicksort-for-linked-list/http://www.geeksforgeeks.org/swap-kth-node-from-beginning-with-kth-node-from-end-in-a-linked-list/http://geeksquiz.com/data-structure/linked-list/http://geeksquiz.com/data-structure/linked-list/http://www.geeksforgeeks.org/swap-kth-node-from-beginning-with-kth-node-from-end-in-a-linked-list/http://www.geeksforgeeks.org/quicksort-for-linked-list/http://www.geeksforgeeks.org/a-linked-list-with-next-and-arbit-pointer/http://www.geeksforgeeks.org/the-great-tree-list-recursion-problem/http://www.geeksforgeeks.org/reverse-a-doubly-linked-list/http://www.geeksforgeeks.org/delete-a-node-in-a-doubly-linked-list/http://geeksquiz.com/doubly-linked-list/http://www.geeksforgeeks.org/sorted-insert-for-circular-linked-list/http://www.geeksforgeeks.org/split-a-circular-linked-list-into-two-halves/http://geeksquiz.com/circular-linked-list-set-2-traversal/http://geeksquiz.com/circular-linked-list/http://www.geeksforgeeks.org/pairwise-swap-elements-of-a-given-linked-list-by-changing-links/http://www.geeksforgeeks.org/merge-a-linked-list-into-another-linked-list-at-alternate-positions/http://www.geeksforgeeks.org/quicksort-on-singly-linked-list/http://www.geeksforgeeks.org/delete-n-nodes-after-m-nodes-of-a-linked-list/

  • 8/16/2019 GeeksforGeeks placement questions

    12/35

    (tatus )omments &o>os>>>>>

    > 3f not !ast node, copy data of next node and de!ete that> &wo travrsa!s, or fast ptr and s!ow ptr> ca!cu!ate !en%th then 5!enHn+26, or two ptrs one strats at nth fro> asy peasy> asy peasy> asy peasy> xtra marked e!e in node struct, hash map, "!oyd> .everse or stack

    > #orma!> 'ots of methods> #orma!> #orma!> two !oops, mer%e sort and prev or hashin>>>

    ddddone and coded

    d reverse and maintain maxNti!!nowI >e! whatever is !essd

    ddd

  • 8/16/2019 GeeksforGeeks placement questions

    13/35

  • 8/16/2019 GeeksforGeeks placement questions

    14/35

    head other from head

  • 8/16/2019 GeeksforGeeks placement questions

    15/35

  • 8/16/2019 GeeksforGeeks placement questions

    16/35

    Question3ntroduction to (tack 3n=x to -ost=x )onversion usin% (tack va!uation of -ost=x xpression.everse a (tin% usin% (tack 3mp!ement two stacks in an array

    )heck for ba!anced parentheses in an expression #ext Greater !ement .everse a stack usin% recursion &he (tock (pan -rob!em>esi%n and 3mp!ement (pecia! (tack >ata (tructure 3mp!ement (tack usin% Queues >esi%n a stack with operations on midd!e e!ementQui* on (tack

    http://geeksquiz.com/stack-set-1/http://geeksquiz.com/stack-set-2-infix-to-postfix/http://geeksquiz.com/stack-set-4-evaluation-postfix-expression/http://geeksquiz.com/stack-set-3-reverse-string-using-stack/http://www.geeksforgeeks.org/archives/18754http://www.geeksforgeeks.org/archives/6547http://www.geeksforgeeks.org/archives/8405http://www.geeksforgeeks.org/archives/6921http://www.geeksforgeeks.org/the-stock-span-problem/http://www.geeksforgeeks.org/design-and-implement-special-stack-data-structure/http://www.geeksforgeeks.org/implement-stack-using-queue/http://www.geeksforgeeks.org/design-a-stack-with-find-middle-operation/http://geeksquiz.com/data-structure/stack/http://geeksquiz.com/data-structure/stack/http://www.geeksforgeeks.org/design-a-stack-with-find-middle-operation/http://www.geeksforgeeks.org/implement-stack-using-queue/http://www.geeksforgeeks.org/design-and-implement-special-stack-data-structure/http://www.geeksforgeeks.org/the-stock-span-problem/http://www.geeksforgeeks.org/archives/6921http://www.geeksforgeeks.org/archives/8405http://www.geeksforgeeks.org/archives/6547http://www.geeksforgeeks.org/archives/18754http://geeksquiz.com/stack-set-3-reverse-string-using-stack/http://geeksquiz.com/stack-set-4-evaluation-postfix-expression/http://geeksquiz.com/stack-set-2-infix-to-postfix/http://geeksquiz.com/stack-set-1/

  • 8/16/2019 GeeksforGeeks placement questions

    17/35

    Question (tatus

    >>>

    Queue 3ntroduction and Array 3mp!ementation 'inked 'ist 3mp!ementation of Queue App!ications of Queue >ata (tructure -riority Queue 3ntroduction >e0ue 53ntroduction and App!ications6

    3mp!ement Queue usin% (tacks )heck whether a %iven /inary &ree is )omp!ete or not "ind the !ar%est mu!tip!e of < "ind the =rst circu!ar tour that visits a!! petro! pumps Maximum of a!! subarrays of si*e k An 3nterestin% Method to Generate /inary #umbers from 2 to nQui* on Queue

    http://geeksquiz.com/queue-set-1introduction-and-array-implementation/http://geeksquiz.com/queue-set-2-linked-list-implementation/http://www.geeksforgeeks.org/archives/11042http://geeksquiz.com/priority-queue-set-1-introduction/http://geeksquiz.com/deque-set-1-introduction-applications/http://www.geeksforgeeks.org/archives/5009http://www.geeksforgeeks.org/archives/23449http://www.geeksforgeeks.org/find-the-largest-number-multiple-of-3/http://www.geeksforgeeks.org/find-a-tour-that-visits-all-stations/http://www.geeksforgeeks.org/maximum-of-all-subarrays-of-size-k/http://www.geeksforgeeks.org/interesting-method-generate-binary-numbers-1-n/http://geeksquiz.com/data-structure/queue/http://geeksquiz.com/data-structure/queue/http://www.geeksforgeeks.org/interesting-method-generate-binary-numbers-1-n/http://www.geeksforgeeks.org/maximum-of-all-subarrays-of-size-k/http://www.geeksforgeeks.org/find-a-tour-that-visits-all-stations/http://www.geeksforgeeks.org/find-the-largest-number-multiple-of-3/http://www.geeksforgeeks.org/archives/23449http://www.geeksforgeeks.org/archives/5009http://geeksquiz.com/deque-set-1-introduction-applications/http://geeksquiz.com/priority-queue-set-1-introduction/http://www.geeksforgeeks.org/archives/11042http://geeksquiz.com/queue-set-2-linked-list-implementation/http://geeksquiz.com/queue-set-1introduction-and-array-implementation/

  • 8/16/2019 GeeksforGeeks placement questions

    18/35

    )omments &/>

    B stacks, make de0ueue expx .ecursive oneen0ueue from root, de0 and check chi!drenusin% number props and < 0ueues for < poss remainders

  • 8/16/2019 GeeksforGeeks placement questions

    19/35

    Question(earch in a row wise and co!umn wise sorted matrix -rint a %iven matrix in spira! form A /oo!ean Matrix Question -rint uni0ue rows in a %iven boo!ean matrix Maximum si*e s0uare subHmatrix with a!! 2s

    -rint uni0ue rows in a %iven boo!ean matrix 3np!ace M x # si*e matrix transpose 1 9pdated -rint Matrix >ia%ona!!y >ynamic -ro%rammin% 1 (et BO 5Maximum sum rectan%!e in a B> matrix6 (trassenLs Matrix Mu!tip!ication )reate a matrix with a!ternatin% rectan%!es of $ and K "ind the row with maximum number of 2s -rint a!! e!ements in sorted order from row and co!umn wise sorted matrix

    http://www.geeksforgeeks.org/search-in-row-wise-and-column-wise-sorted-matrix/http://www.geeksforgeeks.org/print-a-given-matrix-in-spiral-form/http://www.geeksforgeeks.org/a-boolean-matrix-question/http://www.geeksforgeeks.org/print-unique-rows/http://www.geeksforgeeks.org/maximum-size-sub-matrix-with-all-1s-in-a-binary-matrix/http://www.geeksforgeeks.org/print-unique-rows/http://www.geeksforgeeks.org/inplace-m-x-n-size-matrix-transpose/http://www.geeksforgeeks.org/print-matrix-diagonally/http://www.geeksforgeeks.org/dynamic-programming-set-27-max-sum-rectangle-in-a-2d-matrix/http://www.geeksforgeeks.org/strassens-matrix-multiplication/http://www.geeksforgeeks.org/create-a-matrix-with-alternating-rectangles-of-0-and-x/http://www.geeksforgeeks.org/find-the-row-with-maximum-number-1s/http://www.geeksforgeeks.org/print-elements-sorted-order-row-column-wise-sorted-matrix/http://www.geeksforgeeks.org/print-elements-sorted-order-row-column-wise-sorted-matrix/http://www.geeksforgeeks.org/find-the-row-with-maximum-number-1s/http://www.geeksforgeeks.org/create-a-matrix-with-alternating-rectangles-of-0-and-x/http://www.geeksforgeeks.org/strassens-matrix-multiplication/http://www.geeksforgeeks.org/dynamic-programming-set-27-max-sum-rectangle-in-a-2d-matrix/http://www.geeksforgeeks.org/print-matrix-diagonally/http://www.geeksforgeeks.org/inplace-m-x-n-size-matrix-transpose/http://www.geeksforgeeks.org/print-unique-rows/http://www.geeksforgeeks.org/maximum-size-sub-matrix-with-all-1s-in-a-binary-matrix/http://www.geeksforgeeks.org/print-unique-rows/http://www.geeksforgeeks.org/a-boolean-matrix-question/http://www.geeksforgeeks.org/print-a-given-matrix-in-spiral-form/http://www.geeksforgeeks.org/search-in-row-wise-and-column-wise-sorted-matrix/

  • 8/16/2019 GeeksforGeeks placement questions

    20/35

    (tart eith top ri%ht and !eft or down

    /(&d

    d

    dd

  • 8/16/2019 GeeksforGeeks placement questions

    21/35

    &rie

  • 8/16/2019 GeeksforGeeks placement questions

    22/35

    http FFwwwI%eeksfor%eeksIor%FwriteHaHcHpro%ramHtoHprintHa!!HpermutationsHofHaH%ivenHsthttp FFwwwI%eeksfor%eeksIor%F=ndHtheHsma!!estHwindowHinHaHstrin%Hcontainin%Ha!!Hcharahttp FFwwwI%eeksfor%eeksIor%Fsearchin%HforHpatternsHsetHBHkmpHa!%orithmFhttp FFwwwI%eeksfor%eeksIor%F=ndHtheHsma!!estHwindowHinHaHstrin%Hcontainin%Ha!!Hchara

  • 8/16/2019 GeeksforGeeks placement questions

    23/35

    rin%FctersHofHanotherHstrin%F

    ctersHofHanotherHstrin%F

  • 8/16/2019 GeeksforGeeks placement questions

    24/35

  • 8/16/2019 GeeksforGeeks placement questions

    25/35

    Print all nodes at distance k from a given nodeConstruct a tree from Inorder and Level order traversals

    3terative -reorder &raversa! Morris traversa! for -reorder'inked comp!ete binary tree S its creation &ernary (earch &ree (e%ment &ree 1 (et 2 5(um of %iven ran%e6 'ar%est 3ndependent (et -rob!em

    3terative -ostorder &raversa! 1 (et 2 59sin% &wo (tacks6 3terative -ostorder &raversa! 1 (et B 59sin% $ne (tack6 .everse 'eve! $rder &raversa!)onstruct )omp!ete /inary &ree from its 'inked 'ist .epresentation )onvert a %iven /inary &ree to >oub!y 'inked 'ist 1 (et 2 &ree 3somorphism -rob!em "ind a!! possib!e interpretations of an array of di%its 3terative Method to =nd 7ei%ht of /inary &ree )ustom &ree -rob!em )onvert a %iven /inary &ree to >oub!y 'inked 'ist 1 (et B

    -rint ancestors of a %iven binary tree node without recursion >i8erence between sums of odd !eve! and even !eve! nodes of a /inary &ree -rint -ostorder traversa! from %iven 3norder and -reorder traversa!s "ind depth of the deepest odd !eve! !eaf node )heck if a!! !eaves are at same !eve! -rint 'eft Riew of a /inary &ree .emove a!! nodes which donLt !ie in any path with sum T k xtract 'eaves of a /inary &ree in a >oub!y 'inked 'ist >eepest !eft !eaf node in a binary tree "ind next ri%ht node of a %iven key (um of a!! the numbers that are formed from root to !eaf paths )onvert a %iven /inary &ree to >oub!y 'inked 'ist 1 (et < 'owest )ommon Ancestor in a /inary &ree 1 (et 2 "ind distance between two %iven keys of a /inary &ree -rint a!! nodes that are at distance k from a !eaf node )heck if a %iven /inary &ree is hei%ht ba!anced !ike a .edH/!ack &ree Print all nodes at distance k from a given node

    -rint a /inary &ree in Rertica! $rder 1 (et 2

    "ind the maximum path sum between two !eaves of a binary tree .everse a!ternate !eve!s of a perfect binary tree )heck if two nodes are cousins in a /inary &ree )heck if a binary tree is subtree of another binary tree 1 (et B(eria!i*e and >eseria!i*e a /inary &ree -rint nodes between two %iven !eve! numbers of a binary tree

    http://www.geeksforgeeks.org/iterative-preorder-traversal/http://www.geeksforgeeks.org/morris-traversal-for-preorder/http://www.geeksforgeeks.org/linked-complete-binary-tree-its-creation/http://www.geeksforgeeks.org/ternary-search-tree/http://www.geeksforgeeks.org/segment-tree-set-1-sum-of-given-range/http://www.geeksforgeeks.org/largest-independent-set-problem/http://www.geeksforgeeks.org/iterative-postorder-traversal/http://www.geeksforgeeks.org/iterative-postorder-traversal-using-stack/http://www.geeksforgeeks.org/reverse-level-order-traversal/http://www.geeksforgeeks.org/given-linked-list-representation-of-complete-tree-convert-it-to-linked-representation/http://www.geeksforgeeks.org/in-place-convert-a-given-binary-tree-to-doubly-linked-list/http://www.geeksforgeeks.org/tree-isomorphism-problem/http://www.geeksforgeeks.org/find-all-possible-interpretations/http://www.geeksforgeeks.org/iterative-method-to-find-height-of-binary-tree/http://www.geeksforgeeks.org/custom-tree-problem/http://www.geeksforgeeks.org/convert-a-given-binary-tree-to-doubly-linked-list-set-2/http://www.geeksforgeeks.org/print-ancestors-of-a-given-binary-tree-node-without-recursion/http://www.geeksforgeeks.org/difference-between-sums-of-odd-and-even-levels/http://www.geeksforgeeks.org/print-postorder-from-given-inorder-and-preorder-traversals/http://www.geeksforgeeks.org/find-depth-of-the-deepest-odd-level-node/http://www.geeksforgeeks.org/check-leaves-level/http://www.geeksforgeeks.org/print-left-view-binary-tree/http://www.geeksforgeeks.org/remove-all-nodes-which-lie-on-a-path-having-sum-less-than-k/http://www.geeksforgeeks.org/connect-leaves-doubly-linked-list/http://www.geeksforgeeks.org/deepest-left-leaf-node-in-a-binary-tree/http://www.geeksforgeeks.org/find-next-right-node-of-a-given-key/http://www.geeksforgeeks.org/sum-numbers-formed-root-leaf-paths/http://www.geeksforgeeks.org/convert-given-binary-tree-doubly-linked-list-set-3/http://www.geeksforgeeks.org/lowest-common-ancestor-binary-tree-set-1/http://www.geeksforgeeks.org/find-distance-two-given-nodes/http://www.geeksforgeeks.org/print-nodes-distance-k-leaf-node/http://www.geeksforgeeks.org/print-nodes-distance-k-given-node-binary-tree/http://www.geeksforgeeks.org/print-nodes-distance-k-given-node-binary-tree/http://www.geeksforgeeks.org/find-maximum-path-sum-two-leaves-binary-tree/http://www.geeksforgeeks.org/reverse-alternate-levels-binary-tree/http://www.geeksforgeeks.org/check-two-nodes-cousins-binary-tree/http://www.geeksforgeeks.org/check-binary-tree-subtree-another-binary-tree-set-2/http://www.geeksforgeeks.org/serialize-deserialize-binary-tree/http://www.geeksforgeeks.org/given-binary-tree-print-nodes-two-given-level-numbers/http://www.geeksforgeeks.org/given-binary-tree-print-nodes-two-given-level-numbers/http://www.geeksforgeeks.org/serialize-deserialize-binary-tree/http://www.geeksforgeeks.org/check-binary-tree-subtree-another-binary-tree-set-2/http://www.geeksforgeeks.org/check-two-nodes-cousins-binary-tree/http://www.geeksforgeeks.org/reverse-alternate-levels-binary-tree/http://www.geeksforgeeks.org/find-maximum-path-sum-two-leaves-binary-tree/http://www.geeksforgeeks.org/print-nodes-distance-k-given-node-binary-tree/http://www.geeksforgeeks.org/print-nodes-distance-k-given-node-binary-tree/http://www.geeksforgeeks.org/print-nodes-distance-k-leaf-node/http://www.geeksforgeeks.org/find-distance-two-given-nodes/http://www.geeksforgeeks.org/lowest-common-ancestor-binary-tree-set-1/http://www.geeksforgeeks.org/convert-given-binary-tree-doubly-linked-list-set-3/http://www.geeksforgeeks.org/sum-numbers-formed-root-leaf-paths/http://www.geeksforgeeks.org/find-next-right-node-of-a-given-key/http://www.geeksforgeeks.org/deepest-left-leaf-node-in-a-binary-tree/http://www.geeksforgeeks.org/connect-leaves-doubly-linked-list/http://www.geeksforgeeks.org/remove-all-nodes-which-lie-on-a-path-having-sum-less-than-k/http://www.geeksforgeeks.org/print-left-view-binary-tree/http://www.geeksforgeeks.org/check-leaves-level/http://www.geeksforgeeks.org/find-depth-of-the-deepest-odd-level-node/http://www.geeksforgeeks.org/print-postorder-from-given-inorder-and-preorder-traversals/http://www.geeksforgeeks.org/difference-between-sums-of-odd-and-even-levels/http://www.geeksforgeeks.org/print-ancestors-of-a-given-binary-tree-node-without-recursion/http://www.geeksforgeeks.org/convert-a-given-binary-tree-to-doubly-linked-list-set-2/http://www.geeksforgeeks.org/custom-tree-problem/http://www.geeksforgeeks.org/iterative-method-to-find-height-of-binary-tree/http://www.geeksforgeeks.org/find-all-possible-interpretations/http://www.geeksforgeeks.org/tree-isomorphism-problem/http://www.geeksforgeeks.org/in-place-convert-a-given-binary-tree-to-doubly-linked-list/http://www.geeksforgeeks.org/given-linked-list-representation-of-complete-tree-convert-it-to-linked-representation/http://www.geeksforgeeks.org/reverse-level-order-traversal/http://www.geeksforgeeks.org/iterative-postorder-traversal-using-stack/http://www.geeksforgeeks.org/iterative-postorder-traversal/http://www.geeksforgeeks.org/largest-independent-set-problem/http://www.geeksforgeeks.org/segment-tree-set-1-sum-of-given-range/http://www.geeksforgeeks.org/ternary-search-tree/http://www.geeksforgeeks.org/linked-complete-binary-tree-its-creation/http://www.geeksforgeeks.org/morris-traversal-for-preorder/http://www.geeksforgeeks.org/iterative-preorder-traversal/

  • 8/16/2019 GeeksforGeeks placement questions

    26/35

    (tatus )omments&/>

    dd $ne moethod to send root as UU and set it to nu!! in functiomdddd https FFwwwIyoutubeIcomFwatch:vT JVt0VJp(!Qd 0ueue and print every !eve!

    d B stacks, ri%ht !eft order reversed

    dd

  • 8/16/2019 GeeksforGeeks placement questions

    27/35

  • 8/16/2019 GeeksforGeeks placement questions

    28/35

    Variable Declaration

    /asics ) 'an%ua%e 3ntroduction ) -ro%rammin% 'an%ua%e (tandard Is it fine to write “void main()” or “main()” in C/C++? Difference etween “int main()” and “int main(void)” in C/C++?!acros and Pre"rocessors in C #

    >e=nition and (cope 7ow are variab!es scoped in ) W (tatic or >ynamic: (cope ru!es in ) 7ow 'inkers .eso!ve Mu!tip!y >e=ned G!oba! (ymbo!s: $ui% on&aria le Declaration and 'co"e# Com"licated declarations in C

    >ata &ypes 9se of boo! in ) 3nte%er -romotions in ) Qui* on >ata &ypes in )

    )omparison of a Xoat with a va!ue in )

    (tora%e )!asses 9nderstandin% YexternZ keyword in ) hat are the defau!t va!ues of static variab!es in ): nderstanding “volatile” ualifier in C

    )onst Qua!i=er in ) 3nitia!i*ation of static variab!es in ) nderstanding “register” ke*word in C

    Qui* on (tora%e )!asses in )I

    3nputF$utput .eturned va!ues of printf56 and scanf56 hat is return type of %etchar56 f%etc56 and %etc56 : 'cansets in C

    puts56 vs printf56 for printin% a strin% hat is use of n in printf56 : ow to "rint , using "rintf()?

    Qui* on 3nput $utput in )I

    $perators $perator -recedence and Associativity in ) va!uation order of operands /itwise $perators in ) )omma in ) and )++ $perands for si*eof operator A comma operator 0uestion .esu!t of comma operator as !Hva!ue in ) and )++ -rder of o"erands for logical o"erators

    3ncrement 5>ecrement6 operators re0uire 'Hva!ue xpression -recedence of post=x ++ and pre=x ++ in )F)++

    http://geeksquiz.com/c-language-set-1-introduction/http://www.geeksforgeeks.org/c-programming-language-standard/http://www.geeksforgeeks.org/g-fact-16/http://www.geeksforgeeks.org/scope-rules-in-c/http://www.geeksforgeeks.org/how-linkers-resolve-multiply-defined-global-symbols/http://www.geeksforgeeks.org/g-fact-94/http://www.geeksforgeeks.org/integer-promotions-in-c/http://geeksquiz.com/c-language/data-types/http://www.geeksforgeeks.org/comparison-float-value-c/http://www.geeksforgeeks.org/understanding-extern-keyword-in-c/http://www.geeksforgeeks.org/g-fact-53/http://www.geeksforgeeks.org/const-qualifier-in-c/http://www.geeksforgeeks.org/g-fact-80/http://geeksquiz.com/c-language/storage-classes/http://www.geeksforgeeks.org/g-fact-10/http://www.geeksforgeeks.org/g-fact-11/http://www.geeksforgeeks.org/g-fact-11/http://www.geeksforgeeks.org/puts-vs-printf-for-printing-a-string/http://www.geeksforgeeks.org/g-fact-31/http://geeksquiz.com/c-language/input-and-output/http://www.geeksforgeeks.org/c-operator-precedence-associativity/http://www.geeksforgeeks.org/evaluation-order-of-operands/http://www.geeksforgeeks.org/interesting-facts-bitwise-operators-c/http://www.geeksforgeeks.org/comna-in-c-and-c/http://www.geeksforgeeks.org/g-fact-9/http://www.geeksforgeeks.org/a-comma-operator-question/http://www.geeksforgeeks.org/g-fact-78/http://www.geeksforgeeks.org/increment-decrement-operators-require-l-value-expression/http://www.geeksforgeeks.org/g-fact-59/http://www.geeksforgeeks.org/g-fact-59/http://www.geeksforgeeks.org/increment-decrement-operators-require-l-value-expression/http://www.geeksforgeeks.org/g-fact-78/http://www.geeksforgeeks.org/a-comma-operator-question/http://www.geeksforgeeks.org/g-fact-9/http://www.geeksforgeeks.org/comna-in-c-and-c/http://www.geeksforgeeks.org/interesting-facts-bitwise-operators-c/http://www.geeksforgeeks.org/evaluation-order-of-operands/http://www.geeksforgeeks.org/c-operator-precedence-associativity/http://geeksquiz.com/c-language/input-and-output/http://www.geeksforgeeks.org/g-fact-31/http://www.geeksforgeeks.org/puts-vs-printf-for-printing-a-string/http://www.geeksforgeeks.org/g-fact-11/http://www.geeksforgeeks.org/g-fact-11/http://www.geeksforgeeks.org/g-fact-10/http://geeksquiz.com/c-language/storage-classes/http://www.geeksforgeeks.org/g-fact-80/http://www.geeksforgeeks.org/const-qualifier-in-c/http://www.geeksforgeeks.org/g-fact-53/http://www.geeksforgeeks.org/understanding-extern-keyword-in-c/http://www.geeksforgeeks.org/comparison-float-value-c/http://geeksquiz.com/c-language/data-types/http://www.geeksforgeeks.org/integer-promotions-in-c/http://www.geeksforgeeks.org/g-fact-94/http://www.geeksforgeeks.org/how-linkers-resolve-multiply-defined-global-symbols/http://www.geeksforgeeks.org/scope-rules-in-c/http://www.geeksforgeeks.org/g-fact-16/http://www.geeksforgeeks.org/c-programming-language-standard/http://geeksquiz.com/c-language-set-1-introduction/

  • 8/16/2019 GeeksforGeeks placement questions

    29/35

    ow can we return multi"le values from a function?

    !odulus on .egative .um ers

    )F)++ &ernary $perator W (ome 3nterestin% $bservations Pre increment (or "re decrement) in C++

    >i8erence between ++Up Up++ and U++p .esu!ts of comparison operations in ) and )++

    0o find sum of two num ers wit1out using an* o"erator 'e uence Points in C

    -reprocessor rite a ) macro -.3#&5x6 which prints x Rariab!e !en%th ar%uments for MacrosMu!ti!ine macros in ) C23' () macro 4 inter"retation

    &he $""( &$"56 macro 5ranc1 "rediction macros in 6CC

    >i8ference between \de=ne and const in ):

    Arrays S (trin%s >o not use si*eof for array parameters 3nitia!i*ation of variab!es si*ed arrays in ) Are array members deep!y copied: 71at is t1e difference etween single uoted and dou le uoted declaration of c1ar arra*? Initiali%ation of a multidimensional arra*s in C/C++ 7rite one line functions for strcat() and strcm"()

    %ets56 is risky to use ) function to (wap strin%s 'torage for 'trings in C

    >i8erence between array and pointer7ow to dynamica!!y a!!ocate a B> array in ): 7ow to pass a B> array as a parameter in ):

    )ontro! (tatements hat shou!d be data type of case !abe!s of switch statement in ): "or Rersus hi!e A nested !oop pu**!e switch statement in )

    "unctions 3mportance of function prototype in ) "unctions that are executed before and after main56 in ) return statement vs e8it() in main()

    7ow to )ount Rariab!e #umbers of Ar%uments in ): 71at is evaluation order of function "arameters in C?

    >oes ) support function over!oadin%:

    hat is the purpose of a function prototype: 'tatic functions in C

    exit56

    http://www.geeksforgeeks.org/cc-ternary-operator-some-interesting-observations/http://www.geeksforgeeks.org/difference-between-p-p-and-p/http://www.geeksforgeeks.org/difference-between-p-p-and-p/http://www.geeksforgeeks.org/results-of-comparison-operations-in-c-and-c/http://www.geeksforgeeks.org/write-a-c-macro-printx-which-prints-x/http://www.geeksforgeeks.org/variable-length-arguments-for-macros/http://www.geeksforgeeks.org/multiline-macros-in-c/http://www.geeksforgeeks.org/the-offsetof-macro/http://geeksquiz.com/diffference-define-const-c/http://www.geeksforgeeks.org/using-sizof-operator-with-array-paratmeters/http://www.geeksforgeeks.org/g-fact-92/http://www.geeksforgeeks.org/are-array-members-deeply-copied/http://www.geeksforgeeks.org/gets-is-risky-to-use/http://www.geeksforgeeks.org/swap-strings-in-c/http://www.geeksforgeeks.org/difference-pointer-array-c/http://www.geeksforgeeks.org/dynamically-allocate-2d-array-c/http://www.geeksforgeeks.org/pass-2d-array-parameter-c/http://www.geeksforgeeks.org/g-fact-51/http://www.geeksforgeeks.org/for-versus-while/http://www.geeksforgeeks.org/a-nested-loop-puzzle/http://www.geeksforgeeks.org/interesting-facts-about-switch-statement-in-c/http://www.geeksforgeeks.org/importance-of-function-prototype-in-c/http://www.geeksforgeeks.org/functions-that-are-executed-before-and-after-main-in-c/http://www.geeksforgeeks.org/how-to-count-variable-numbers-of-arguments-in-c/http://www.geeksforgeeks.org/does-c-support-function-overloading/http://www.geeksforgeeks.org/what-is-the-purpose-of-a-function-prototype/http://www.geeksforgeeks.org/understanding-exit-abort-and-assert/http://www.geeksforgeeks.org/understanding-exit-abort-and-assert/http://www.geeksforgeeks.org/what-is-the-purpose-of-a-function-prototype/http://www.geeksforgeeks.org/does-c-support-function-overloading/http://www.geeksforgeeks.org/how-to-count-variable-numbers-of-arguments-in-c/http://www.geeksforgeeks.org/functions-that-are-executed-before-and-after-main-in-c/http://www.geeksforgeeks.org/importance-of-function-prototype-in-c/http://www.geeksforgeeks.org/interesting-facts-about-switch-statement-in-c/http://www.geeksforgeeks.org/a-nested-loop-puzzle/http://www.geeksforgeeks.org/for-versus-while/http://www.geeksforgeeks.org/g-fact-51/http://www.geeksforgeeks.org/pass-2d-array-parameter-c/http://www.geeksforgeeks.org/dynamically-allocate-2d-array-c/http://www.geeksforgeeks.org/difference-pointer-array-c/http://www.geeksforgeeks.org/swap-strings-in-c/http://www.geeksforgeeks.org/gets-is-risky-to-use/http://www.geeksforgeeks.org/are-array-members-deeply-copied/http://www.geeksforgeeks.org/g-fact-92/http://www.geeksforgeeks.org/using-sizof-operator-with-array-paratmeters/http://geeksquiz.com/diffference-define-const-c/http://www.geeksforgeeks.org/the-offsetof-macro/http://www.geeksforgeeks.org/multiline-macros-in-c/http://www.geeksforgeeks.org/variable-length-arguments-for-macros/http://www.geeksforgeeks.org/write-a-c-macro-printx-which-prints-x/http://www.geeksforgeeks.org/results-of-comparison-operations-in-c-and-c/http://www.geeksforgeeks.org/difference-between-p-p-and-p/http://www.geeksforgeeks.org/difference-between-p-p-and-p/http://www.geeksforgeeks.org/cc-ternary-operator-some-interesting-observations/

  • 8/16/2019 GeeksforGeeks placement questions

    30/35

    Enum

    abort56 and assert56 Im"licit return t*"e int in C

    hat happens when a function is ca!!ed before its dec!aration in ):

    -ointers hy ) treats array parameters as pointers: $utput of the pro%ram 1 >ereference

    .eference >ereference .eference I 3n ncommon re"resentation of arra* elements

    7ow to dec!are a pointer to a function: Pointer vs 3rra* in C

    void pointer in )

    (truct and 9nion num in )

    (tructures in ) 9nion in ) (truct 7ack (tructure Member A!i%nment -addin% and >ata -ackin% $perations on struct variab!es in )

    Memory Mana%ement Memory 'ayout of ) -ro%rams ow to deallocate memor* wit1out using free() in C?

    ca!!oc56 versus ma!!oc56 7ow does free56 know the si*e of memory to be dea!!ocated:9se of rea!!oc56 71at is !emor* Leak? ow can we avoid?

    "i!e 7and!in% fseek56 vs rewind56 in ) $" %etc56 and feof56 in ) fopen56 for an existin% =!e in write mode

    -u**!es 7ow to =nd sum of two numbers without usin% any operator 7ow wi!! you show memory representation of ) variab!es: Condition 0o Print “ ello7ord”

    )han%eFadd on!y one character and print ^UL exact!y B4 times ow can we sum t1e digits of a given num er in single statement?

    hat is the best way in ) to convert a number to a strin%: Calculate Logn in one line

    -rint Y venZ or Y$ddZ without usin% )onditiona! statement 7ow wi!! you print numbers from 2 to 244 without usin% !oop: 7ow can we sum the di%its of a %iven number in sin%!e statement:

    http://www.geeksforgeeks.org/understanding-exit-abort-and-assert/http://www.geeksforgeeks.org/g-fact-95/http://www.geeksforgeeks.org/why-c-treats-array-parameters-as-pointers/http://www.geeksforgeeks.org/dereference-reference-dereference-reference/http://www.geeksforgeeks.org/dereference-reference-dereference-reference/http://www.geeksforgeeks.org/dereference-reference-dereference-reference/http://www.geeksforgeeks.org/dereference-reference-dereference-reference/http://www.geeksforgeeks.org/how-to-declare-a-pointer-to-a-function/http://geeksquiz.com/void-pointer-c/http://geeksquiz.com/enumeration-enum-c/http://geeksquiz.com/structures-c/http://geeksquiz.com/union-c/http://www.geeksforgeeks.org/struct-hack/http://www.geeksforgeeks.org/structure-member-alignment-padding-and-data-packing/http://www.geeksforgeeks.org/structure-member-alignment-padding-and-data-packing/http://www.geeksforgeeks.org/g-fact-68/http://www.geeksforgeeks.org/memory-layout-of-c-program/http://www.geeksforgeeks.org/calloc-versus-malloc/http://www.geeksforgeeks.org/g-fact-88/http://www.geeksforgeeks.org/g-fact-66/http://www.geeksforgeeks.org/g-fact-82/http://www.geeksforgeeks.org/eof-and-feof-in-c/http://www.geeksforgeeks.org/eof-and-feof-in-c/http://www.geeksforgeeks.org/fopen-for-an-existing-file-in-write-mode/http://www.geeksforgeeks.org/to-find-sum-of-two-numbers-without-using-any-operator/http://www.geeksforgeeks.org/how-will-you-show-memory-representation-of-c-variables/http://www.geeksforgeeks.org/changeadd-only-one-character-and-print-exactly-20-times/http://www.geeksforgeeks.org/what-is-the-best-way-in-c-to-convert-a-number-to-a-string/http://www.geeksforgeeks.org/even-or-odd-without-using-condtional-statement/http://www.geeksforgeeks.org/how-will-you-print-numbers-from-1-to-200-without-using-loop/http://www.geeksforgeeks.org/how-can-we-sum-the-digits-of-a-given-number-in-single-statement/http://www.geeksforgeeks.org/how-can-we-sum-the-digits-of-a-given-number-in-single-statement/http://www.geeksforgeeks.org/how-will-you-print-numbers-from-1-to-200-without-using-loop/http://www.geeksforgeeks.org/even-or-odd-without-using-condtional-statement/http://www.geeksforgeeks.org/what-is-the-best-way-in-c-to-convert-a-number-to-a-string/http://www.geeksforgeeks.org/changeadd-only-one-character-and-print-exactly-20-times/http://www.geeksforgeeks.org/how-will-you-show-memory-representation-of-c-variables/http://www.geeksforgeeks.org/to-find-sum-of-two-numbers-without-using-any-operator/http://www.geeksforgeeks.org/fopen-for-an-existing-file-in-write-mode/http://www.geeksforgeeks.org/eof-and-feof-in-c/http://www.geeksforgeeks.org/eof-and-feof-in-c/http://www.geeksforgeeks.org/g-fact-82/http://www.geeksforgeeks.org/g-fact-66/http://www.geeksforgeeks.org/g-fact-88/http://www.geeksforgeeks.org/calloc-versus-malloc/http://www.geeksforgeeks.org/memory-layout-of-c-program/http://www.geeksforgeeks.org/g-fact-68/http://www.geeksforgeeks.org/structure-member-alignment-padding-and-data-packing/http://www.geeksforgeeks.org/structure-member-alignment-padding-and-data-packing/http://www.geeksforgeeks.org/struct-hack/http://geeksquiz.com/union-c/http://geeksquiz.com/structures-c/http://geeksquiz.com/enumeration-enum-c/http://geeksquiz.com/void-pointer-c/http://www.geeksforgeeks.org/how-to-declare-a-pointer-to-a-function/http://www.geeksforgeeks.org/dereference-reference-dereference-reference/http://www.geeksforgeeks.org/dereference-reference-dereference-reference/http://www.geeksforgeeks.org/dereference-reference-dereference-reference/http://www.geeksforgeeks.org/dereference-reference-dereference-reference/http://www.geeksforgeeks.org/why-c-treats-array-parameters-as-pointers/http://www.geeksforgeeks.org/g-fact-95/http://www.geeksforgeeks.org/understanding-exit-abort-and-assert/

  • 8/16/2019 GeeksforGeeks placement questions

    31/35

    7ow wi!! you print YGeeks for GeeksZ without usin% a semico!on rite a one !ine ) function to round Xoatin% point numbers 7ow wi!! imp!ement _our $wn si*eof ow to count set its in a floating "oint num er in C? ow to c1ange t1e out"ut of "rintf() in main() ? ow to find lengt1 of a string wit1out string#1 and loo" in C?

    Im"lement *our own itoa() rite a ) pro%ram that does not terminate when )tr!+) is pressed 7ow to measure time taken by a function in ): -rint a !on% int in ) usin% putchar56 on!y )onvert a Xoatin% point number to strin% in ) 7ow to write a runnin% ) code without main56:

    http://www.geeksforgeeks.org/write-a-c-program-to-print-geeks-for-geeks-without-using-a-semicolon/http://www.geeksforgeeks.org/write-a-c-function-to-round-floating-point-numbers/http://www.geeksforgeeks.org/implement-your-own-sizeof/http://www.geeksforgeeks.org/write-a-c-program-that-doesnt-terminate-when-ctrlc-is-pressed/http://www.geeksforgeeks.org/how-to-measure-time-taken-by-a-program-in-c/http://www.geeksforgeeks.org/print-long-int-number-c-using-putchar/http://www.geeksforgeeks.org/convert-floating-point-number-string/http://www.geeksforgeeks.org/write-running-c-code-without-main/http://www.geeksforgeeks.org/write-running-c-code-without-main/http://www.geeksforgeeks.org/convert-floating-point-number-string/http://www.geeksforgeeks.org/print-long-int-number-c-using-putchar/http://www.geeksforgeeks.org/how-to-measure-time-taken-by-a-program-in-c/http://www.geeksforgeeks.org/write-a-c-program-that-doesnt-terminate-when-ctrlc-is-pressed/http://www.geeksforgeeks.org/implement-your-own-sizeof/http://www.geeksforgeeks.org/write-a-c-function-to-round-floating-point-numbers/http://www.geeksforgeeks.org/write-a-c-program-to-print-geeks-for-geeks-without-using-a-semicolon/

  • 8/16/2019 GeeksforGeeks placement questions

    32/35

    http FFwwwI%eeksfor%eeksIor%FreturnHmaximumHoccurrin%HcharacterHinHtheHinputHstrin%Fhttp FFwwwI%eeksfor%eeksIor%FremoveHa!!Hdup!icatesHfromHtheHinputHstrin%Fhttp FFwwwI%eeksfor%eeksIor%FaHpro%ramHtoHcheckHifHstrin%sHareHrotationsHofHeachHotherHorHnotFhttp FFwwwI%eeksfor%eeksIor%FprintH!istHitemsHcontainin%Ha!!HcharactersHofHaH%ivenHwordF

  • 8/16/2019 GeeksforGeeks placement questions

    33/35

    d B@` si*e arrayd do in p!ace with res in and ipind concatenate and checkd bin map, unset and count

  • 8/16/2019 GeeksforGeeks placement questions

    34/35

    Mathematica! A!%orithms rite an Pcient Method to )heck if a #umber is Mu!tip!e of < Pcient way to mu!tip!y with O rite a ) pro%ram to print a!! permutations of a %iven strin% 'ucky #umbers rite a pro%ram to add two numbers in base 2? /aby!onian method for s0uare root

    Mu!tip!y two inte%ers without usin% mu!tip!ication division and bitwise operators and no !oops -rint a!! combinations of points that can compose a %iven number rite you own -ower without usin% mu!tip!ication5U6 and division5F6 operators -ro%ram for "ibonacci numbers Avera%e of a stream of numbers )ount numbers that donLt contain < Ma%ic (0uare (ieve of ratosthenes

    "ind day of the week for a %iven date >"A based division Generate inte%er from 2 to O with e0ua! probabi!ity Given a number =nd the next sma!!est pa!indrome Make a fair coin from a biased coin )heck divisibi!ity by O "ind the !ar%est mu!tip!e of < 'exico%raphic rank of a strin% -rint a!! permutations in sorted 5!exico%raphic6 order (huEe a %iven array (pace and time ePcient /inomia! )oePcient .eservoir (amp!in% -asca!Ls &rian%!e (e!ect a random number from stream with $526 space "ind the !ar%est mu!tip!e of B < and @ Pcient pro%ram to ca!cu!ate eCx Measure one !itre usin% two vesse!s and in=nite water supp!y Pcient pro%ram to print a!! prime factors of a %iven number -rint a!! possib!e combinations of r e!ements in a %iven array of si*e n .andom number %enerator in arbitrary probabi!ity distribution fashion 7ow to check if a %iven number is "ibonacci number: .ussian -easant Mu!tip!ication )ount a!! possib!e %roups of si*e B or < that have sum as mu!tip!e of <

    &ower of 7anoi 7ornerLs Method for -o!ynomia! va!uation )ount trai!in% *eroes in factoria! of a number

    http://www.geeksforgeeks.org/write-an-efficient-method-to-check-if-a-number-is-multiple-of-3/http://www.geeksforgeeks.org/efficient-way-to-multiply-with-7/http://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/http://www.geeksforgeeks.org/lucky-numbers/http://www.geeksforgeeks.org/write-a-program-to-add-two-numbers-in-base-14/http://www.geeksforgeeks.org/square-root-of-a-perfect-square/http://www.geeksforgeeks.org/multiply-two-numbers-without-using-multiply-division-bitwise-operators-and-no-loops/http://www.geeksforgeeks.org/multiply-two-numbers-without-using-multiply-division-bitwise-operators-and-no-loops/http://www.geeksforgeeks.org/multiply-two-numbers-without-using-multiply-division-bitwise-operators-and-no-loops/http://www.geeksforgeeks.org/print-all-combinations-of-points-that-can-compose-a-given-number/http://www.geeksforgeeks.org/write-you-own-power-without-using-multiplication-and-division/http://www.geeksforgeeks.org/program-for-nth-fibonacci-number/http://www.geeksforgeeks.org/average-of-a-stream-of-numbers/http://www.geeksforgeeks.org/count-numbers-that-dont-contain-3/http://www.geeksforgeeks.org/magic-square/http://www.geeksforgeeks.org/sieve-of-eratosthenes/http://www.geeksforgeeks.org/find-day-of-the-week-for-a-given-date/http://www.geeksforgeeks.org/dfa-based-division/http://www.geeksforgeeks.org/generate-integer-from-1-to-7-with-equal-probability/http://www.geeksforgeeks.org/given-a-number-find-next-smallest-palindrome-larger-than-this-number/http://www.geeksforgeeks.org/given-a-number-find-next-smallest-palindrome-larger-than-this-number/http://www.geeksforgeeks.org/print-0-and-1-with-50-probability/http://www.geeksforgeeks.org/divisibility-by-7/http://www.geeksforgeeks.org/find-the-largest-number-multiple-of-3/http://www.geeksforgeeks.org/lexicographic-rank-of-a-string/http://www.geeksforgeeks.org/lexicographic-permutations-of-string/http://www.geeksforgeeks.org/shuffle-a-given-array/http://www.geeksforgeeks.org/space-and-time-efficient-binomial-coefficient/http://www.geeksforgeeks.org/reservoir-sampling/http://www.geeksforgeeks.org/pascal-triangle/http://www.geeksforgeeks.org/select-a-random-number-from-stream-with-o1-space/http://www.geeksforgeeks.org/select-a-random-number-from-stream-with-o1-space/http://www.geeksforgeeks.org/find-the-largest-multiple-of-2-3-and-5/http://www.geeksforgeeks.org/find-the-largest-multiple-of-2-3-and-5/http://www.geeksforgeeks.org/program-to-efficiently-calculate-ex/http://www.geeksforgeeks.org/measure-1-litre-from-two-vessels-infinite-water-supply/http://www.geeksforgeeks.org/print-all-prime-factors-of-a-given-number/http://www.geeksforgeeks.org/print-all-possible-combinations-of-r-elements-in-a-given-array-of-size-n/http://www.geeksforgeeks.org/random-number-generator-in-arbitrary-probability-distribution-fashion/http://www.geeksforgeeks.org/check-number-fibonacci-number/http://www.geeksforgeeks.org/fast-multiplication-method-without-using-multiplication-operator-russian-peasants-algorithm/http://www.geeksforgeeks.org/count-possible-groups-size-2-3-sum-multiple-3/http://geeksquiz.com/c-program-for-tower-of-hanoi/http://www.geeksforgeeks.org/horners-method-polynomial-evaluation/http://www.geeksforgeeks.org/count-trailing-zeroes-factorial-number/http://www.geeksforgeeks.org/count-trailing-zeroes-factorial-number/http://www.geeksforgeeks.org/horners-method-polynomial-evaluation/http://geeksquiz.com/c-program-for-tower-of-hanoi/http://www.geeksforgeeks.org/count-possible-groups-size-2-3-sum-multiple-3/http://www.geeksforgeeks.org/fast-multiplication-method-without-using-multiplication-operator-russian-peasants-algorithm/http://www.geeksforgeeks.org/check-number-fibonacci-number/http://www.geeksforgeeks.org/random-number-generator-in-arbitrary-probability-distribution-fashion/http://www.geeksforgeeks.org/print-all-possible-combinations-of-r-elements-in-a-given-array-of-size-n/http://www.geeksforgeeks.org/print-all-prime-factors-of-a-given-number/http://www.geeksforgeeks.org/measure-1-litre-from-two-vessels-infinite-water-supply/http://www.geeksforgeeks.org/program-to-efficiently-calculate-ex/http://www.geeksforgeeks.org/find-the-largest-multiple-of-2-3-and-5/http://www.geeksforgeeks.org/find-the-largest-multiple-of-2-3-and-5/http://www.geeksforgeeks.org/select-a-random-number-from-stream-with-o1-space/http://www.geeksforgeeks.org/select-a-random-number-from-stream-with-o1-space/http://www.geeksforgeeks.org/pascal-triangle/http://www.geeksforgeeks.org/reservoir-sampling/http://www.geeksforgeeks.org/space-and-time-efficient-binomial-coefficient/http://www.geeksforgeeks.org/shuffle-a-given-array/http://www.geeksforgeeks.org/lexicographic-permutations-of-string/http://www.geeksforgeeks.org/lexicographic-rank-of-a-string/http://www.geeksforgeeks.org/find-the-largest-number-multiple-of-3/http://www.geeksforgeeks.org/divisibility-by-7/http://www.geeksforgeeks.org/print-0-and-1-with-50-probability/http://www.geeksforgeeks.org/given-a-number-find-next-smallest-palindrome-larger-than-this-number/http://www.geeksforgeeks.org/given-a-number-find-next-smallest-palindrome-larger-than-this-number/http://www.geeksforgeeks.org/generate-integer-from-1-to-7-with-equal-probability/http://www.geeksforgeeks.org/dfa-based-division/http://www.geeksforgeeks.org/find-day-of-the-week-for-a-given-date/http://www.geeksforgeeks.org/sieve-of-eratosthenes/http://www.geeksforgeeks.org/magic-square/http://www.geeksforgeeks.org/count-numbers-that-dont-contain-3/http://www.geeksforgeeks.org/average-of-a-stream-of-numbers/http://www.geeksforgeeks.org/program-for-nth-fibonacci-number/http://www.geeksforgeeks.org/write-you-own-power-without-using-multiplication-and-division/http://www.geeksforgeeks.org/print-all-combinations-of-points-that-can-compose-a-given-number/http://www.geeksforgeeks.org/multiply-two-numbers-without-using-multiply-division-bitwise-operators-and-no-loops/http://www.geeksforgeeks.org/multiply-two-numbers-without-using-multiply-division-bitwise-operators-and-no-loops/http://www.geeksforgeeks.org/multiply-two-numbers-without-using-multiply-division-bitwise-operators-and-no-loops/http://www.geeksforgeeks.org/square-root-of-a-perfect-square/http://www.geeksforgeeks.org/write-a-program-to-add-two-numbers-in-base-14/http://www.geeksforgeeks.org/lucky-numbers/http://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/http://www.geeksforgeeks.org/efficient-way-to-multiply-with-7/http://www.geeksforgeeks.org/write-an-efficient-method-to-check-if-a-number-is-multiple-of-3/

  • 8/16/2019 GeeksforGeeks placement questions

    35/35

    -ro%ram for nth )ata!an #umber Generate one of < numbers accordin% to %iven probabi!ities "ind xce! co!umn name from a %iven co!umn number"ind next %reater number with same set of di%its)ount -ossib!e >ecodin%s of a %iven >i%it (e0uence )a!cu!ate the an%!e between hour hand and minute hand

    )ount number of binary strin%s without consecutive 2:s"ind the sma!!est number whose di%its mu!tip!y to a %iven number n >raw a circ!e without Xoatin% point arithmetic

    http://www.geeksforgeeks.org/program-nth-catalan-number/http://www.geeksforgeeks.org/write-a-function-to-generate-3-numbers-according-to-given-probabilities/http://www.geeksforgeeks.org/find-excel-column-name-given-number/http://www.geeksforgeeks.org/find-next-greater-number-set-digits/http://www.geeksforgeeks.org/count-possible-decodings-given-digit-sequence/http://www.geeksforgeeks.org/calculate-angle-hour-hand-minute-hand/http://www.geeksforgeeks.org/count-number-binary-strings-without-consecutive-1s/http://www.geeksforgeeks.org/find-smallest-number-whose-digits-multiply-given-number-n/http://geeksquiz.com/draw-circle-without-floating-point-arithmetic/http://geeksquiz.com/draw-circle-without-floating-point-arithmetic/http://www.geeksforgeeks.org/find-smallest-number-whose-digits-multiply-given-number-n/http://www.geeksforgeeks.org/count-number-binary-strings-without-consecutive-1s/http://www.geeksforgeeks.org/calculate-angle-hour-hand-minute-hand/http://www.geeksforgeeks.org/count-possible-decodings-given-digit-sequence/http://www.geeksforgeeks.org/find-next-greater-number-set-digits/http://www.geeksforgeeks.org/find-excel-column-name-given-number/http://www.geeksforgeeks.org/write-a-function-to-generate-3-numbers-according-to-given-probabilities/http://www.geeksforgeeks.org/program-nth-catalan-number/