Capital One Lipotso tsa Puisano

Capital One Array Lipotso

Potso ea 1. Tharollo e le 'ngoe ea Leetcode Polelo ea bothata Bothateng "Plus One" re fuoa lethathamo moo karolo ka 'ngoe e ka har'a palo e emelang palo ea palo. Sehlopha se felletseng se emetse palo. Index ea zeroth e emela MSB ea palo. Re ka nahana hore ha ho na zero e etellang pele ho ...

Bala haholoanyane

Potso ea 2. Bala liketsahalo tsohle tse nang le sehlahisoa se ka tlase ho K Bothata "Bala tsohle tse latelang tse nang le sehlahisoa se ka tlase ho K" e re o fuoe lethathamo la linomoro. Hona joale fumana palo ea liphetho tse nang le sehlahisoa se ka tlase ho kenyelletso e fanoeng K. Mohlala a [] = {1, 2, 3, 4, 5} k = 8 Palo ea tse latelang tlase ...

Bala haholoanyane

Potso ea 3. Fumana efe kapa efe ea likarolo tse pheta-phetoang ka ho bala feela bothata "Fumana e 'ngoe ea likarolo tse pheta-phetoang tse ngata ka ho bala feela" e re ha re re o fuoa boholo ba boholo ba ho bala (n + 1). Sehlopha se na le linomoro ho tloha ho 1 ho isa ho n. Mosebetsi oa hau ke ho fumana engoe ea lintho tse pheta-phetoang ho ...

Bala haholoanyane

Potso ea 4. Lipotso tsa GCD ea linomoro tsohle tsa sehlopha ntle le likarolo tsa mofuta o fanoeng Polelo ea Bothata Bothata ba "Lipotso bakeng sa GCD ea linomoro tsohle tsa sehlopha ntle le likarolo tsa mofuta o fanoeng" bothata bo re o tla fuoa lenane le felletseng la lipotso. Potso ka 'ngoe e na le nomoro e setseng le ho le letona. Polelo ea bothata e kopa ho fumana ...

Bala haholoanyane

Potso ea 5. Likarolo tsa khafetsa tsa K tse holimo Polelo ea Bothata Linthong tse holimo tsa K khafetsa re fane ka li-num tse ngata [], fumana likarolo tsa k tse etsahalang khafetsa. Mehlala nums [] = {1, 1, 1, 2, 2, 3} k = 2 1 2 nums [] = {1} k = 1 1 Mokhoa o se nang tsebo bakeng sa Lihaha tsa Khafetsa tsa K tse Holimo ...

Bala haholoanyane

Potso ea 6. Litsela tse tharo tsa ho arola mefuta e mengata ho potoloha sebaka se fanoeng Polelo ea Bothata O fuoa linomoro tse ngata le lenane la lowValue le highValue. Bothata "Likarolo tse tharo tsa karohano ea sehlopha ho potoloha le mefuta e fanoeng" bo kopa ho arola mefuta e mengata e joalo e tla aroloa likarolo tse tharo. Likarolo tsa likarolo li tla ba: Elements ...

Bala haholoanyane

Potso ea 7. Fumana tatellano e hlophisitsoeng ea boholo ba 3 ka nako e lekanang Polelo ea Bothata Bothata "Fumana tatellano e hlophisitsoeng ea boholo ba 3 ka nako e lekanang" e re o na le lenane le le leng. Polelo ea bothata e kopa ho fumana linomoro tse tharo ka tsela eo li hlophisang [i] <array [k] <array [k], le i <j <k. Mohlala arr [] ...

Bala haholoanyane

Potso ea 8. Kakaretso ea likarolo tsa bonyane le tse phahameng tsa litepana tsohle tsa boholo k Polelo ea Bothata Bothata "Kakaretso ea likarolo tse nyane le tse phahameng tsa lithupa tse nyane tsa boholo k" e re o fuoe lethathamo le nang le linomoro tse ntle le tse fosahetseng, fumana lintlha tsa bonyane le boholo ba likarolo tsohle tsa boholo ba k. Mehlala arr [] = {5, 9, 8, 3, ...

Bala haholoanyane

Potso ea 9. Tlosa likarolo tsohle tse mpe ho fella ka tatellano ka sebaka se eketsehileng se lumelletsoeng Polelo ea Bothata "Tsamaisa likarolo tsohle tse mpe ho emisa ka tatellano ka sebaka se eketsehileng se lumelletsoeng" e re o filoe lethathamo le nang le linomoro tse ntle le tse fosahetseng ka bobeli. Polelo ea bothata e kopa ho tsamaisa likarolo tsohle tse mpe qetellong ea sehlopha. Mohlala arr [] = {1,2, -3, -5,2,7, -9, -11} 1, ...

Bala haholoanyane

Potso ea 10. Fumana subarray ka bonyane karolelano Polelo ea Bothata U fane ka palo e felletseng le nomoro k. Polelo ea bothata e kopa ho fumana karoloana e nang le bonyane karolelano, e leng ho fumana likaroloana tsa likarolo tsa k, tse nang le bonyane ba karolelano. Mohlala arr [] = {12, 34, 20, 30, 24, 45} k = 3 Sub-Array of [0, 2] e na le average e tlase. Tlhaloso: ...

Bala haholoanyane

Potso ea 11. Bonyane palo ea li-subsets tse nang le likarolo tse ikhethang Polelo ea Bothata Ha re re u na le mefuta e mengata ea boholo ba n. Polelo ea bothata e kopa ho fumana palo e tlase ea li-subsets tse nang le likarolo tse ikhethileng, ke li-subsets tse ka thehoang tse nang le likarolo tsohle tse fapaneng / tse fapaneng ho tsoa sehlopheng. Mohlala arr [] = {2,4,6,2,1,4,2} 3 Tlhaloso: {1, ...

Bala haholoanyane

Potso ea 12. Bala mehato e fokolang ho fumana lenane leo u le batlang Tlhaloso ea Bothata Ha re re u na le sehlopha se nang le palo e le 'ngoe feela e le likarolo tsohle tsa eona. Nahana, o fuoa bolelele ba bolelele ba ho ba le li-0 tsohle moo re tlamehang ho fetolela li-0 ho sehlopha se fanoeng se hlokahalang. Re ka bolela lebitso le hlokehang joalo ka ha re lakatsaArr ...

Bala haholoanyane

Potso ea 13. Nomoro e sieo Bothateng ba Nomoro e Haellang re fane ka boholo ba boholo ba N bo nang le nomoro ho tloha ho 0 ho isa ho N. Litekanyetso tsohle tsa sehlopha li ikhethile. Re hloka ho fumana palo e sieo e seng teng ka bongata mme palo eo e pakeng tsa 0 le N. Mona ...

Bala haholoanyane

Potso ea 14. Bothata ba Phetoho ea Chelete ea tšepe Bothata ba Phetoho ea Chelete ea Chelete - Ho fanoe ka lichelete tsa tšepe tsa boleng bo fapaneng c1, c2,…, cs (Mohlala: 1,4,7….). Re hloka palo n. Sebelisa licheleteng tsena tsa tšepe ho etsa chelete n. U ka sebelisa chelete ea tšepe makhetlo a mangata kamoo ho hlokahalang. Fumana palo eohle ea litsela tseo ka tsona ...

Bala haholoanyane

Potso ea 15. Beakanya lipalo tse ntle le tse fosahetseng ka tsela e 'ngoe ho Array Polelo ea Bothata Bothateng ba "Hlophisa Linomoro Tse Ntle le Tse Fosahetseng ka Tsela e 'Ngoe ka Tsela" re fane ka letoto le []. Sehlopha sena se na le linomoro tse nepahetseng le tse fosahetseng. Beakanya lintho ka bongata ka tsela ea hore tse ntle le tse mpe li beoe ka tsela e ngoe. Mona, palo ea likarolo tse ntle le tse mpe ha e hloke ...

Bala haholoanyane

Potso ea 16. Fumana karolo e lahlehileng ho tsoa ho lenane le kopitsitsoeng Polelo ea Bothata ha e fuoa likarolo tse peli tsa A le B, sehlopha se le seng ke lefahla le leng ntle le ntho e le 'ngoe. Karolo e le 'ngoe e haelloa ke A kapa B. re hloka ho fumana ntho e lahlehileng ho tsoa lenaneng le kopilitsoeng. Mohlala 5 1 6 4 8 9 6 4 8 ...

Bala haholoanyane

Potso ea 17. Lokisetsa bocha lenane le fuoeng boholo bo tlase Polelo ea Bothata Bothateng ba "Rearange Array in Maximum Minimum Form" bothata, re fane ka sehlopha se hlophisitsoeng se nang le likarolo tsa N. Beakanya botjha mefuta e felletseng ya dinomoro tse nepahetseng, hore dikarolo tse ding di be max le min min. Sheba ka tlase bakeng sa kutloisiso e betere ea ho hlophisoa bocha ha likarolo- Array [0] ...

Bala haholoanyane

Potso ea 18. Tlosa Zero Tsohle Qetellong ea Lenane le Fuoeng Polelo ea Bothata Lethathamong le fanoeng tsamaisa linoto tsohle tse teng ka har'a sehlopha ho fihlela qetellong. Mona ho lula ho na le mokhoa oa ho kenya linomoro tsohle ho isa qetellong ea sehlopha. Ho kenya mohlala 9 9 17 0 14 0 ...

Bala haholoanyane

Potso ea 19. Fumana palo e nyane ka ho fetisisa e sieo ka tatellano e hlophiloeng Polelo ea Bothata Bothateng ba "Fumana Ntho e Nyane ka ho Fetisisa e Fosahetseng ka tatellano e hlophisitsoeng" re fane ka lenane le le leng. Fumana nomoro e nyane ka ho fetisisa e sieo lenaneng le hlophisitsoeng ka boholo ba N le nang le likarolo tse ikhethileng ho 0 ho M-1, moo M> N. Ho kenya mohlala [0, 1, 2, 3, 4, 6, 7, ...

Bala haholoanyane

Potso ea 20. Fumana Nomoro e Haellang Polelo ea Bothata Ha re fumana linomoro tse sieo ho tsoa lenaneng la linomoro tse 1 ho isa ho tse N re fane ka lethathamo le nang le linomoro tsa N-1. Nomoro e le 'ngoe ha e na palo ea linomoro ho tloha ho 1 ho ea ho N. Re tlameha ho fumana nomoro e sieo. Fomate ea Input Mohala oa pele o nang le palo e felletseng ...

Bala haholoanyane

Lipotso tsa Capital One String

Potso ea 21. License Key Formatting Leetcode Tharollo Polelo ea Bothata Bothateng "Fomate ea Senotlolo sa License", kenyelletso e na le letoto la litlhaku, tse emelang senotlolo sa laesense. Qalong, khoele e arotsoe ka lihlopha tsa N + 1 (mantsoe) ka N dashes bohareng. Re boetse re fuoa palo e kholo ea K, 'me sepheo ke ho fomata khoele ...

Bala haholoanyane

Potso ea 22. Nako e telele e phetoang Bothata "Ho latela Nako e Telele ka ho Fetisisa" bo re o fuoe khoele hore o kenye letsoho. Fumana tatellano e telele ka ho fetesisa e phetoang, ke ketsahalo e teng habeli ka khoele. Mohlala aeafbdfdg 3 (afd) Atamela Bothata bo re botsa ho fumana tatellano e telele ka ho fetesisa e phetoang khoeleng. ...

Bala haholoanyane

Potso ea 23. Motsoako oa Litlhaku tsa Nomoro ea Mohala Ka litlhaku tse kopaneng tsa bothata ba nomoro ea mohala, re fane ka khoele e nang le linomoro ho tloha ho 2 ho isa ho 9. Nomoro ea palo ke ...

Bala haholoanyane

Potso ea 24. Tlhaloso ea Mongolo Tharollo ea LeetCode Re tla tšohla Text Justification LeetCode Tharollo kajeno Polelo ea Bothata Bothata "Text Justification" e bolela hore u fuoa lethathamo s[ ] la mofuta oa khoele ea boholo ba n le boholo ba palo e feletseng. Netefatsa sengoloa hore mola o mong le o mong oa mongolo o na le palo ea boholo ba litlhaku. U ka khona ...

Bala haholoanyane

Potso ea 25. Mohlala oa Lentsoe Kaofela re kopane le lipaterone tsa mantsoe joalo ka "ABBA", "AABB" joalo-joalo. Kamehla rea ​​ipotsa hore na babble ee e ka amana le eng. Kajeno re tla leka ho rarolla bothata moo re lekang ho sebelisa babble. Mathata a mangata a likhoele ha a thuse nyeoe. Fuoa ...

Bala haholoanyane

Potso ea 26. Lekola hore na lenane le hokahaneng la likhoele le etsa Palindrome Polelo ea Bothata Bothateng ba "Hlahloba hore na lenane le hokahaneng la likhoele le etsa bothata ba Palindrome" re fane ka lenane le hokahaneng la ho sebetsana le data ea likhoele. Ngola lenaneo ho lekola hore na data e theha palindrom kapa che. Mohlala ba-> c-> d-> ca-> b 1 Tlhaloso: Mohlala o kaholimo rea bona hore ...

Bala haholoanyane

Capital One Tree Lipotso

Potso ea 27. Fetolela BST e tloaelehileng ho BST e leka-lekaneng Polelo ea Bothata e Fuoe Sefate sa Patlo ea Binary (BST), ngola algorithm ho fetolela BST ho Sefate se Ts'oanang sa Binary Search. Sefate sa Binary Search se leka-lekaneng ha se letho haese sefate sa patlo ea binary seo phapang ea sona lipakeng tsa bophahamo ba subtree ea leqele le letsohong le letona e ka tlase ho kapa e lekanang le 1. ...

Bala haholoanyane

Potso ea 28. Sefate se lumellanang Bothateng ba Sefate sa Symmetric re file sefate sa binary, ho sheba hore na ke seipone ka bosona. Sefate se boleloa e le setšoantšo sa seipone ha ho na le axis ea symmetry ka motso oa motso o arolang sefate likarolo tse peli tse tšoanang. Mefuta ea Mehlala ...

Bala haholoanyane

Lipotso tsa Capital One Stack

Potso ea 29. Tharollo ea Min Stack Leetcode Rala Setatemente sa Mathata `` stack '' e ts'ehetsang Push, Pop, top le ho fumana lintlha tse tlase ka nako e sa fetoheng. Sututsa (x) - Sututsa elemente x holima stack. pop () - E tlosa karolo kaholimo ho mokotla. top () - Fumana karolo e holimo. GetMin () - Khutlisa bonyane ba karolo ka har'a mokotla. ...

Bala haholoanyane

Potso ea 30. Min Stack Mathateng a min stack re tlameha ho rala stack ho kenya tšebetsong mesebetsi e latelang ka nepo, sututsa (x) -> Sutumelletsa element x ho stack stack () -> E tlosa ntho kaholimo ho stack top () -> Khutlisa element ka holim'a stack getMin () -> Khutlisa bonyane ba elemente bo teng ...

Bala haholoanyane

Lipotso tsa Capital One Queue

Potso ea 31. Kakaretso ea likarolo tsa bonyane le tse phahameng tsa litepana tsohle tsa boholo k Polelo ea Bothata Bothata "Kakaretso ea likarolo tse nyane le tse phahameng tsa lithupa tse nyane tsa boholo k" e re o fuoe lethathamo le nang le linomoro tse ntle le tse fosahetseng, fumana lintlha tsa bonyane le boholo ba likarolo tsohle tsa boholo ba k. Mehlala arr [] = {5, 9, 8, 3, ...

Bala haholoanyane

Capital One Lipotso tse ling

Potso ea 32. Tlhaloso ea Lentsoe LeetCode Tharollo Polelo ea Bothata Tharollo ea Lentsoe LeetCode Tharollo - Re fuoa likhoele tsa 2 - "s" le "mohlala", re hloka ho fumana hore na mohlala o latela s. Ho latela mona ho bolela papali e felletseng. Ka mokhoa o hlophisitsoeng, re ka khona molemong o mong le o mong[i] ho tlameha ho ba le s[i] e le 'ngoe feela, ka tsela e fapaneng ke hore ho na le ...

Bala haholoanyane

Potso ea 33. Tlosa Lihokelo tsa Leetcode Tharollo Polelo ea Bothata Bothateng bona, re fuoa lenane le hokahanngoeng le li-node tsa lona tse nang le litekanyetso tse kholo. Re hloka ho hlakola linomoro tse ling lenaneng tse nang le boleng bo lekanang le val. Bothata ha bo hloke ho rarolloa sebakeng se le seng empa re tla tšohla mokhoa o le mong o joalo. Lethathamo la Mehlala = ...

Bala haholoanyane

Potso ea 34. Tharollo ea Lethathamo la Leetcode la Palindrome Bothateng ba "Palindrome Linked List", re tlameha ho lekola hore na lenane le fuoeng la bong bo le bong bo hokahaneng ke palindrome kapa che. Lethathamo la Mehlala = {1 -> 2 -> 3 -> 2 -> 1} Tlhaloso ea 'nete # 1: Lenane lena le palindrome joalo ka ha likarolo tsohle ho tloha qalong le morao li le ...

Bala haholoanyane

Potso ea 35. Kopanya Manane a mabeli a hlophisitsoeng Leetcode Solutions Lethathamo le hokahaneng le batla le tšoana le lihlopha tsa thepa ea tsona. Re ka kopanya mefuta e 'meli e hlophisitsoeng ho etsa sehlopha se hlophisitsoeng ka kakaretso. Bothateng bona, re tlameha ho kopanya manane a mabeli a hokahaneng hore a khutlise lenane le lecha le nang le likarolo tsa manane ka bobeli ka mokhoa o hlophisitsoeng. Mohlala ...

Bala haholoanyane

Potso ea 36. Bala Liqeto tsa Leetcode Solutions Bothateng bona, re fuoa palo e felletseng, N. Morero ke ho bala hore na linomoro tse ka tlase ho N, ke li-primes. Linomoro li tlameha ho ba tse seng mpe. Mohlala 7 3 10 4 Tlhaloso Makhetho a ka tlase ho 10 ke 2, 3, 5 le 7. Kahoo, palo ke 4. Atamela (Brute ...

Bala haholoanyane

Potso ea 37. Kopanya Mananeo a Mabeli a Hlophisitsoeng Ho kopanya manane a mabeli a hokahaneng re a file lintlha tsa lihlooho tse peli tse hokahaneng, o li kopanye joalo ka hore ho fumanoe lenane le le leng le hokahaneng le nang le linomoro tse nang le litekanyetso ka tatellano e hlophisitsoeng khutlisa sesupa-hlooho sa lenane le kopaneng. Tlhokomeliso: kopanya lenane le hokahaneng sebakeng ntle le ho sebelisa ...

Bala haholoanyane

Potso ea 38. Kopanya Manane a mabeli a hlophisitsoeng Leetcode Motsoako o kopaneng oa mefuta e 'meli ke bothata bofe ho leetcode? Ena ke potso e khahlisang haholo e botsitsoeng makhetlo a mangata ho li-compnies tse kang Amazon, Oracle, Microsoft, jj. Bothateng bona (Merge Two Sorted Lists Leetcode), re file manane a mabeli a hokahaneng. Manane ka bobeli a hokahaneng a ntse a eketseha ka tatellano. Kopanya lenane ka bobeli le hokahaneng ho ...

Bala haholoanyane

Potso ea 39. Ts'ebetsong ea LRU Cache Cache e sa tsoa sebelisoa (LRU) Cache ke mofuta oa mokhoa o sebelisetsoang ho boloka lintlha joalo hore nako e hlokahalang ea ho sebelisa data ke bonyane bo ka khonehang. LRU algorithm e sebelisitsoeng ha cache e tletse. Re tlosa lintlha tse sa tsoa sebelisoa habonolo mohopolong oa polokelo ea ...

Bala haholoanyane

Potso ea 40. Sieve ea Eratosthenes Sieve of Eratosthenes ke algorithm eo ho eona re fumanang linomoro tsa mantlha tse ka tlase ho N. Mona N ke boleng bo felletseng. Ena ke mokhoa o sebetsang oa ho fumana linomoro tsa mantlha ho isa moeling. Ka ho sebelisa sena re ka fumana linomoro tse kholo ho fihlela 10000000. Mona ...

Bala haholoanyane

Translate »