eBay Lipotso tsa Puisano

eBay Array Lipotso

Potso ea 1. Tharollo ea Leetcode ea Metsi a ho Tlisa Pula Polelo ea Bothata The Trapping Rain Water LeetCode Solution - "Trapping Rain Water" e bolela hore ho fanoe ka lethathamo la libaka tse phahameng tse emelang 'mapa oa bophahamo moo bophara ba bar e' ngoe le e 'ngoe e leng 1. Re hloka ho fumana palo ea metsi a qabeletsoeng ka mor'a pula. Mohlala: Kenyo: bophahamo = [0,1,0,2,1,0,1,3,2,1,2,1] Sephetho: 6 Tlhaloso: Sheba ...

Bala haholoanyane

Potso ea 2. Hlopha Array ka ho eketsa Tharollo ea Maqhubu a Leetcode Polelo ea Bothata Ho Hlopha Array ka Ho Eketsa Maqhubu a LeetCode Tharollo - "Hlopha Array ka Keketseho ea Maqhubu" e re u filoe lethathamo la lipalo tse felletseng, hlophisa lethathamo ka tatellano e ntseng e eketseha ho latela khafetsa ea boleng. Litekanyetso tse peli kapa ho feta li na le makhetlo a tšoanang, re hloka ho li hlophisa ...

Bala haholoanyane

Potso ea 3. Motsoako oa Tharollo ea Leetcode Bothata ba Combination Sum Leetcode Solution bo re fa lethathamo kapa lenane la linomoro le sepheo. Re bolelloa hore re fumane metsoako e ka etsoang ho sebelisa linomoro tsena ka makhetlo a mang le a mang a eketsang sepheo se fanoeng. Ka mokhoa o fetisisang, re ka sebelisa se fanoeng ...

Bala haholoanyane

Potso ea 4. Hlopha Array ka ho eketsa Tharollo ea Maqhubu a Leetcode Polelo ea Bothata Ha u fuoa manane a mangata a mangata, hlophisa tatellano ka tatellano e ntseng e hola ho ipapisitsoe le makhetlo a litekanyetso Haeba litekanyetso tse ngata li na le maqhubu a tšoanang, li hlophise ka tatellano e fokotsehang. Mohlala nums = [1,1,2,2,2,3] [3,1,1,2,2,2] Tlhaloso: '3' e na le makhetlo a 1, '1' e na le makhetlo a ...

Bala haholoanyane

Potso ea 5. Tharollo e Amanang ea Mofuta oa Leetcode Bothateng bona, re fuoa mefuta e 'meli ea linomoro tse nepahetseng. Lintho tsohle tsa sehlopha sa bobeli li ikhethile 'me li teng ka har'a sehlopha sa pele. Leha ho le joalo, sehlopha sa pele se ka ba le likarolo tse kopilitsoeng kapa likarolo tse seng sehlopheng sa bobeli. Re hloka ho hlophisa sehlopha sa pele ...

Bala haholoanyane

Potso ea 6. Kopanya Tharollo ea Leetcode e hlophisitsoeng Bothateng ba "Merge Sorted Arrays", re fuoa mefuta e 'meli e hlophisitsoeng ka tatellano e sa theoheng. Sehlopha sa pele ha sea tlatsoa ka botlalo ebile se na le sebaka se lekaneng ho amohela likarolo tsohle tsa sehlopha sa bobeli. Re tlameha ho kopanya li-arrays tse peli, hore sehlopha sa pele se na le likarolo ...

Bala haholoanyane

Potso ea 7. Batla ka Tharollo ea Leetcode ea Arled Array Arched Nahana ka sehlopha se hlophisitsoeng empa ho ile ha khethoa index e le 'ngoe' me sehlopha sa potoloha ka nako eo. Joale, hang ha sehlopha se se se potolohiloe ho hlokahala hore u fumane ntho e ikhethileng ebe u khutlisa index ea eona. Haeba ho joalo, elemente ha e eo, khutla -1. Bothata ka kakaretso ke ...

Bala haholoanyane

Potso ea 8. Kth element e kholo ho Array Leetcode Solutions Bothateng bona re tlameha ho khutlisa ntlha e kholo ea kth ka tatellano e sa hlophisoang. Hlokomela hore sehlopha se ka ba le likopi. Kahoo, re tlameha ho fumana karolo e kholo ea Kth ka tatellano e hlophisitsoeng, eseng karolo e kholo ea Kth e kholo. Mohlala A = {4, 2, 5, 3 ...

Bala haholoanyane

Potso ea 9. Nako e molemohali ea ho reka le ho rekisa setoko Polelo ea Bothata Bothata "Nako e Ntle ea ho Reka le ho Rekisa Li-stock" e re o fuoe lethathamo la litheko tsa bolelele n, moo karolo eo e bolokang theko ea setoko ka letsatsi leo. Haeba re ka etsa khoebo e le 'ngoe feela, ke hore, ho reka ka letsatsi le le leng ...

Bala haholoanyane

Potso ea 10. 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 11. Phahamisa kakaretso ea liphapang tse latellanang ka tatellano e chitja Polelo ea Bothata Ha re re u na le lenane le lekaneng Sehlopha sena se lokela ho tšoaroa joalo ka selikalikoe se chitja. Boleng ba ho qetela ba sehlopha bo tla hokahanngoa le sehlopha sa pele, e leng ⇒ a1. Bothata "Ho eketsa kakaretso ea liphapang tse latellanang ka tatellano e chitja" e kopa ho fumana boholo ...

Bala haholoanyane

Potso ea 12. 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 13. Lenaneo la bothata ba Bridge le Torch Polelo ea Bothata Bothata ba "Bridge le Torch" bo re o fuoa nako e ngata eo motho a hlokang ho e tšela. Kaha ke nako, e na le linomoro tse nepahetseng. Hammoho le nako eo re fuoang borokho, eo motho a hlokang ho e tšela. Borokho bo lumella feela ...

Bala haholoanyane

Potso ea 14. Kopanya Likhaohano tse Kopaneng Ha re kopanya bothata ba linako tse lekanang re fane ka pokello ea linako, kopanya le ho khutlisa linako tsohle tse lekanang. Kenyelletso ea Mohlala: [[2, 3], [3, 4], [5, 7]] Sephetho: [[2, 4], [5, 7]] Tlhaloso: Re ka kopanya [2, 3] le [3 , 4] hammoho ho theha [2, 4] Mokhoa oa ho fumana Merge ...

Bala haholoanyane

Potso ea 15. Batla Element ho Lenane la Rotated Array Ha re ntse re batlana le bothata bo hlophisitsoeng bo hlophisitsoeng re fane ka mofuta o hlophisitsoeng le o potolohileng le ntlha, sheba hore na karolo e fanoeng e teng ka har'a sehlopha kapa che. Mehlala Linomoro tsa ho kenya linomoro [] = {2, 5, 6, 0, 0, 1, 2} target = 0 Ho hlahisa linomoro tsa 'nete tsa ho kenya [] = {2, ...

Bala haholoanyane

Potso ea 16. Motswako Sum Ha re kopanya mathata re fane ka mefuta e mengata ea linomoro tse nepahetseng arr [] le kakaretso s, fumana mefuta eohle e ikhethang ea likarolo ho arr [] moo kakaretso ea likarolo tseo e lekanang le s. Nomoro e ts'oanang e phetoang e kanna ea khethoa ho arr [] palo e sa lekanyetsoang ea makhetlo. Lintho ...

Bala haholoanyane

Potso ea 17. Batla ka Lethathamong le hlophisitsoeng la Rotated Patlo ea likarolo ka tatellano e hlophiloeng e potolohileng e ka fumanoa ho sebelisoa patlo ea binary ka nako ea O (logn). Morero oa poso ena ke ho fumana ntho e fanoeng ka tatellano e hlophisitsoeng ka nako ea O (logn). Ho fanoa ka mohlala o mong oa mofuta o hlophisitsoeng o hlophisitsoeng. Keletso ea Mohlala: arr [] = {7,8,9,10,1,2,3,5,6}; ...

Bala haholoanyane

Potso ea 18. Ho kopanya Likarolo Ha re kopanya likhaohano mathata re fane ka sete ea linako tsa sebopeho [l, r], kopanya likarolo tse tlamang. Keketso ea Mehlala {[1, 3], [2, 6], [8, 10], [15, 18]} Sephetho {[1, 6], [8, 10], [15, 18]} Keletso 1, 4], [1, 5]} Sephetho {[1, 5]} Mokhoa o se nang tsebo oa ho kopanya likarolo ...

Bala haholoanyane

Potso ea 19. Hlopha Colours Ho hlophisa mebala ke bothata moo re tlamehang ho fana ka lethathamo le nang le lintho tsa N. Lebokose le leng le le leng le pentiloe ka 'mala o le mong o ka ba khubelu, o moputsoa le o mosoeu. Re na le lintho tsa N tse seng li pentiloe. Re tlameha ho hlophisa mefuta e mengata hoo 'mala o tšoanang ...

Bala haholoanyane

Potso ea 20. Kakaretso ea Likarolo tse lekana le k Ho fanoe ka palo e felletseng le kakaretso k. Fumana palo e felletseng ea litapole tse tsamaellanang tsa sehlopha se fanoeng seo likarolo tsa sona li lekanang le k. Mohlala Keletso 1: arr [] = {5,0,5,10,3,2, -15,4} k = 5 Output: 7 Input 2: arr [] = {1,1,1,2,4, -2} k = 2 Sephetho: Tlhaloso e 4: nahana ka mohlala-1 ...

Bala haholoanyane

Potso ea 21. Kopanya Likhaohano tse Kopaneng II Polelo ea Bothata Bothateng ba "Kopanya Likarohano tse Kopaneng tsa Bobeli" re fane ka sete ea linako. Ngola lenaneo le tla kopanya mekhahlelo e kenang ho e le ngoe ebe o hatisa linako tsohle tse sa lekanang. Fomate ea ho kenya Mohala oa pele o nang le palo e kholo n. Mohala oa bobeli o nang le lipara moo para ka 'ngoe e leng ...

Bala haholoanyane

Potso ea 22. Palo e kahodimodimo ea Kakaretso ea Keketseho Polelo ea Bothata Bothateng ba "Boholo bo Eketsehileng ba Kakaretso" re fane ka letoto. Fumana kakaretso ea boholo ba tatellano e fanoeng, ke hore linomoro tse latelang li hlophisitsoe ka tatellano. Ketsahalo e latelang ke karolo ea tatellano eo e leng tatellano eo e leng ...

Bala haholoanyane

Potso ea 23. Fumana Palo e Phethahetseng e Phethahetseng ho Array Polelo ea Bothata Bothateng ba "Fumana Palo e Phethahetseng e Phethahetseng ka Lethathamo" re fane ka mefuta e sa lekanyetsoang ea boholo N. Re filoe mefuta e mengata e nang le linomoro tsa {0, k} moo k <= N. Fumana nomoro e tlang ka palo e holimo ea linako tse ngata ka tatellano. Sebopeho sa Input The ...

Bala haholoanyane

Potso ea 24. Bothata ba ho arola Polelo ea Bothata Bothateng ba karohano, re fane ka sete e nang le lintho tsa n. Fumana hore na sete e fanoeng e ka aroloa ka lihlopha tse peli tseo likarolo tsa eona li-subsets li lekanang. Mohlala Input arr [] = {4, 5, 11, 9, 8, 3} Output Yes Tlhaloso Lethathamo ...

Bala haholoanyane

Potso ea 25. Subarray ka Kakaretso e fanoeng Polelo ea Bothata Karolong e ka tlase ea bothata bo fanoeng, re fane ka sehlopha se nang le likarolo tse ntle. Re tlameha ho fumana karoloana eo ho eona kakaretso ea likarolo tsohle tsa karoloana e lekanang le given_sum. Subarray e fumaneha ho tsoa ho sehlopha sa mantlha ka ho hlakola tse ling ...

Bala haholoanyane

Potso ea 26. 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 27. Kopanya Lisebelisoa tse peli tse hlophisitsoeng Polelo ea Bothata Ho kopanya mathata a mabeli a hlophisitsoeng, re fane ka lintlha tse peli tse hlophisitsoeng tse kentsoeng, re hloka ho kopanya likarolo tsena tse peli hore linomoro tsa pele kamora ho hlopha ka botlalo li be sehlopheng sa pele mme li lule sehlopheng sa bobeli. Keletso ea Mohlala A [] = {1, 3, 5, 7, ...

Bala haholoanyane

Potso ea 28. Palo ea Boraro-bo-bong e nang le Kakaretso e ka tlase ho Boleng bo Fuoeng Polelo ea Bothata Re fane ka lenane le nang le linomoro tsa N tse ngata. Lethathamong le fanoeng, bala palo ea mafahla a mararo ka chelete e ka tlase ho boleng bo fanoeng. Ho kenya mohlala a [] = {1, 2, 3, 4, 5, 6, 7, 8} Kakaretso = Liphetho tse 10 Tse ka bang teng tse tharo tse tharo ke tsena: ...

Bala haholoanyane

Potso ea 29. Ho kopanya mefuta e 'meli e hlophisitsoeng Polelo ea Bothata Ha re kopanya bothata ba lihlopha tse peli tse hlophisitsoeng re fane ka mefuta e 'meli e hlophisitsoeng, e' ngoe e nang le boholo ba m + n le e 'ngoe e nang le boholo n. Re tla kopanya mefuta e fapaneng ea n + m le n size array ebe re hatisa m + n boholo bo kopaneng. Mohlala Input 6 3 M [] = ...

Bala haholoanyane

Potso ea 30. Fumana Triplet ka Lethathamo ka Kakaretso e Fuoeng Polelo ea Bothata Ha u fuoa mefuta e mengata ea linomoro, fumana motsoako oa likarolo tse tharo tsa lenane leo kakaretso ea lona e lekanang le boleng bo fanoeng X. Mona re tla hatisa motswako oa pele oo re o fumanang. Haeba ho se na kopano e joalo, hatisa -1. Ho kenya mohlala N = 5, X = 15 arr [] = ...

Bala haholoanyane

Potso ea 31. Nomoro e nyane ka ho fetisisa e sieo ka tatellano e sa hlophisoang Polelo ea Bothata Lethathamong le fanoeng le sa hlophisoang fumana palo e nyane ka ho fetisisa e nepahetseng e le sieo ka tatellano e sa hlophisoang. Nomoro e nepahetseng ha e kenyeletse 0. Re ka fetola mefuta ea mantlha ha ho hlokahala. Sehlopha se ka ba le linomoro tse ntle le tse fosahetseng. Mohlala a. Lenane la ho kenya: [3, 4, -1, 0, -2, 2, 1, ...

Bala haholoanyane

Potso ea 32. 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 33. 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 34. Ntho ea pele e pheta-phetoang Polelo ea Bothata Re fane ka lenane le nang le linomoro. Re tlameha ho fumana ntho ea pele e iphetang lethathamong le fanoeng. Haeba ho se na ntho e phetoang joale hatisa "Ha ho na palo e phetoang e fumanoeng". Tlhokomeliso: Lintho tse pheta-phetoang ke likarolo tse tlang hangata. (Lethathamo le kanna la ba le mafahla) ...

Bala haholoanyane

Potso ea 35. Sehlahisoa sa Array Puzzle Polelo ea Bothata Bothateng ba selotho se nang le lihlahisoa re hloka ho theha sehlopha moo karolo ea eona e tla ba sehlahisoa sa likarolo tsohle tse lenaneng le fanoeng ntle le karolo ea boemo ba eona. Keletso ea mohlala 5 10 3 5 6 2 Khumo 180 600 360 300 900 ...

Bala haholoanyane

Potso ea 36. Fumana nomoro ea pele e iphetang ka tatellano e fanoeng Polelo ea Bothata Ho ka ba le linomoro tse pheta-phetoang tse ngata ka bongata empa u tlameha ho fumana nomoro ea pele e pheta-phetoang ka tatellano e fanoeng (e hlahang ka lekhetlo la bobeli). Keketso ea Mohlala 12 5 4 2 8 9 7 12 5 6 12 4 7 Khumo ea 5 ke ntho ea pele e iphetang ...

Bala haholoanyane

Potso ea 37. 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

eBay Lipotso tsa String

Potso ea 38. Tharollo e sebetsang ea Palindrome II ea Leetcode Phatlalatso ea Bothata Tharollo e Tiileng ea Palindrome II LeetCode - "Palindrome II e Tiileng" e bolela hore ho fanoe ka khoele s, re hloka ho khutlela 'nete haeba s e ka ba khoele ea palindrome ka mor'a ho hlakola boholo ba sebopeho se le seng. Mohlala: Kenyeletso: s = "aba" Sephetho: Tlhaloso ea 'nete: Khoele ea ho kenya e se e ntse e le palindrome, kahoo ho na le ...

Bala haholoanyane

Potso ea 39. Tharollo e Kholo ka ho Fetisisa ea Leetcode Polelo ea Bothata Tharollo ea LeetCode ea Nomoro e Khōlō ka ho Fetisisa - "Palo e Khōlō ka ho Fetisisa" e bolela hore ho fanoe ka lethathamo la linomoro tsa "non-negative integers", re hloka ho hlophisa linomoro ka tsela eo li etsang palo e kholo ka ho fetisisa le ho e khutlisa. Kaha sephetho se ka ba seholo haholo, kahoo o hloka ho khutla ...

Bala haholoanyane

Potso ea 40. 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 41. Mohala o molelele ka ho Fetisisa Ntle le ho Pheta Litlhaku Tharollo ea LeetCode Mohala o molelele ka ho Fetisisa o sa Phetang Litlhaku Tharollo ea LeetCode - Ho fanoe ka khoele, re tlameha ho fumana bolelele ba mohala o molelele ka ho fetisisa ntle le ho pheta-pheta litlhaku. Ha re shebeng mehlala e seng mekae: Mohlala pwwkew 3 Tlhaloso: Karabo ke “wke” ka bolelele ba 3 aav 2 Tlhaloso: Karabo ke “av” ka bolelele 2 Atamela-1 ...

Bala haholoanyane

Potso ea 42. 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 43. Lipotso tsa Palindrome Substring Polelo ea Bothata Bothata "Lipotso tsa Palindrome Substring" e re o fuoa Khoele le lipotso tse ling. Ka lipotso tseo, u tlameha ho tseba hore na mohala o entsoeng ho tsoa potsong eo ke palindrome kapa che. Mohlala String str = "aaabbabbaaa" Lipotso q [] = {{2, 3}, {2, 8}, {5, 7}, ...

Bala haholoanyane

Potso ea 44. Tsamaisa khoele Ha re re, o fuoa khoele e kentsoeng. Thapo e kentsoe ka mofuta o itseng oa paterone, mosebetsi oa hau ke ho khetholla khoele. Ha re re, <no of times khoele e etsahala> [khoele] Mohlala Keletso 3 [b] 2 [bc] Tlhaloso ea bbbcaca Tlhaloso Mona "b" e hlaha makhetlo a 3 le "ca" e hlaha makhetlo a 2. ...

Bala haholoanyane

Potso ea 45. Nako e telele ka ho fetisisa e latelang U fuoe likhoele tse peli str1 le str2, fumana bolelele ba nako e telele e tloaelehileng e latelang. Ho latellana: tatellano ke tatellano e ka tsoang tatellanong e ngoe ka ho hlakola tse ling kapa ho se na lintho ntle le ho fetola tatellano ea likarolo tse setseng. Bakeng sa ex 'tticp' ke tse latelang ...

Bala haholoanyane

Potso ea 46. Nako e telele ka ho fetisisa e tloaelehileng e sebelisang ho hlophisa Ho Lumellana Prefix e Telele ka ho Fetisisa u sebelisa bothata ba ho Hlopha re fane ka letoto la likhoele, fumana sephetho se tloaelehileng se telele ka ho fetisisa. ke hore, fumana karolo ea ketapele e tloaelehileng ho likhoele tsohle. Mohlala Input1: {"tutorialcup", "tutorial", "tussle", "tumble"} Sephetho: "tu" Input2: {"thoto", "banana", "batsmen"} Sephetho: "ba" Input3: {"abcd "Khumo:" abcd "...

Bala haholoanyane

Potso ea 47. Ho Ipapisa le Kamehla Mathateng a Mathateng a Tlhaloso ea Kamehla re fane ka likhoele tse peli e le 'ngoe (a re nke hore x) e na le lialfabeta tse nyane feela ebe ea bobeli (ha re nahane hore ke y) e na le lialfabeta tse nang le litlhaku tse tlase tse nang le litlhaku tse peli tse ikhethang ke hore, "." le "*". Mosebetsi ke ho fumana hore na khoele ea bobeli ...

Bala haholoanyane

Potso ea 48. Hlophisa Khoele Mathateng a Reorganize String re file khoele e nang le litlhaku tse ling "az" feela. Mosebetsi oa rona ke ho hlophisa litlhaku tseo hore ho se be le baphetoa ba babeli ba tšoanang. Mohlala Keletso ea apole Khumo pelpa Buka ea ho kenya Khumo Ketso ea ho kenya Input aa Ha ho khonehe Ho kenya aaab Ho tsoa ha ho ...

Bala haholoanyane

Potso ea 49. Nako e telele ka ho fetisisa e tloaelehileng e sebelisang Trie Ho Longest Common Prefix e sebelisang bothata ba Trie re fane ka likhoele, fumana sephetho sa pele se tloaelehileng ka ho fetisisa. ke hore, fumana karolo ea pele e tloaelehileng ho likhoele tsohle. Mohlala Input1: {"tutorialcup", "tutorial", "tussle", "tumble"} Sephetho: "tu" Input2: {"thoto", "banana", "batsmen"} Sephetho: "ba" Input3: {"abcd "Khumo:" abcd "...

Bala haholoanyane

Potso ea 50. Nako e telele ka ho Fetisisa e Tloaelehileng ea Lentsoe ka ho Bapisa Lentsoe Polelo ea Bothata Bothateng ba "Longest Common Prefix o sebelisa Word by Word Matching", re file N strings. Ngola lenaneo ho fumana sephetho se tloaelehileng se telele ka ho fetisisa sa likhoele tse fanoeng. Fomate ea ho kenya Mohala oa pele o nang le boleng ba palo e kholo ea N e bolelang palo ea likhoele. Melao e latelang ea N ...

Bala haholoanyane

Potso ea 51. Nako e telele ka ho fetisisa e tloaelehileng e sebelisang Sebopeho ka ho Bapisa Batho Polelo ea Bothata Bothateng ba "Longest Common Prefix using Character by Character Matching" re fane ka boleng ba palo e felletseng ea likhoele tsa N le N. Ngola lenaneo ho fumana sephetho se tloaelehileng se telele ka ho fetisisa sa likhoele tse fanoeng. Fomate ea ho Kena Mohala oa pele o nang le boleng bo boholo ba N bo bolelang palo ...

Bala haholoanyane

Potso ea 52. Litumello tsa khoele e fanoeng e sebelisa STL Polelo ea Bothata Mathateng a "Litumello tsa mohala o fanoeng o sebelisa STL", re fane ka khoele "s". Hatisa litumello tsohle tsa khoele ea ho kenya u sebelisa mesebetsi ea STL. Fomete ea Input Mohala oa pele le o le mong feela o nang le khoele “s”. Sebopeho sa Khatiso Hatisa tumello eohle ea se fanoeng ...

Bala haholoanyane

Potso ea 53. Telele ka ho Fetisisa e Tloaelehileng E Sebelisa Binary Search II Polelo ea Bothata Bothateng ba "Longest Common Prefix Using Binary Search II" re fane ka boleng ba palo e felletseng ea likhoele tsa N le N. Ngola lenaneo le tla hatisa selelekela se tloaelehileng se telele ka ho fetisisa sa likhoele tse fanoeng. Haeba ho se na sephetho se tloaelehileng, ngola "-1". Fomate ea ho Kena Mohala oa pele o nang le ...

Bala haholoanyane

Potso ea 54. Bolelele ba nako e telele ka ho fetisisa e sebetsang Polelo ea Bothata Ho "Bolelele ba Nako e telele ka ho fetisisa e sebetsang" re fane ka khoele e nang le masakana a qalang le a koalang feela. Ngola lenaneo le tla fumana mohala oa khale ka ho fetisisa o nepahetseng. Fomate ea ho kenya: Mohala oa pele le o le mong feela o nang le khoele s. Sebopeho sa Phatlalatso ea Pele le ...

Bala haholoanyane

eBay Tree Lipotso

Potso ea 55. Binary Tree odara ka mokhoa oa zigzag Ho tsamaea Fuoa sefate sa binary, hatisa tsela ea zigzag ea tatellano ea litekanyetso tsa eona tsa node. (ke hore, ho tloha ka letsohong le letšehali ho ea ho le letona, ho tloha ho le letona ho ea ho le letšehali bakeng sa boemo bo latelang ebe o chencha pakeng tsa) Mohlala nahana ka sefate sa binary se fanoeng ka tlase ka tlase ke ho putlama ha maemo a zigzag ho mefuta e kaholimo ea sefate sa binary ...

Bala haholoanyane

Potso ea 56. 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

Potso ea 57. Nako e telele ka ho fetisisa e tloaelehileng e sebelisang Trie Ho Longest Common Prefix e sebelisang bothata ba Trie re fane ka likhoele, fumana sephetho sa pele se tloaelehileng ka ho fetisisa. ke hore, fumana karolo ea pele e tloaelehileng ho likhoele tsohle. Mohlala Input1: {"tutorialcup", "tutorial", "tussle", "tumble"} Sephetho: "tu" Input2: {"thoto", "banana", "batsmen"} Sephetho: "ba" Input3: {"abcd "Khumo:" abcd "...

Bala haholoanyane

eBay Lipotso tsa Stack

Potso ea 58. Tharollo ea Leetcode ea Metsi a ho Tlisa Pula Polelo ea Bothata The Trapping Rain Water LeetCode Solution - "Trapping Rain Water" e bolela hore ho fanoe ka lethathamo la libaka tse phahameng tse emelang 'mapa oa bophahamo moo bophara ba bar e' ngoe le e 'ngoe e leng 1. Re hloka ho fumana palo ea metsi a qabeletsoeng ka mor'a pula. Mohlala: Kenyo: bophahamo = [0,1,0,2,1,0,1,3,2,1,2,1] Sephetho: 6 Tlhaloso: Sheba ...

Bala haholoanyane

Potso ea 59. Tsamaisa khoele Ha re re, o fuoa khoele e kentsoeng. Thapo e kentsoe ka mofuta o itseng oa paterone, mosebetsi oa hau ke ho khetholla khoele. Ha re re, <no of times khoele e etsahala> [khoele] Mohlala Keletso 3 [b] 2 [bc] Tlhaloso ea bbbcaca Tlhaloso Mona "b" e hlaha makhetlo a 3 le "ca" e hlaha makhetlo a 2. ...

Bala haholoanyane

Potso ea 60. Binary Tree odara ka mokhoa oa zigzag Ho tsamaea Fuoa sefate sa binary, hatisa tsela ea zigzag ea tatellano ea litekanyetso tsa eona tsa node. (ke hore, ho tloha ka letsohong le letšehali ho ea ho le letona, ho tloha ho le letona ho ea ho le letšehali bakeng sa boemo bo latelang ebe o chencha pakeng tsa) Mohlala nahana ka sefate sa binary se fanoeng ka tlase ka tlase ke ho putlama ha maemo a zigzag ho mefuta e kaholimo ea sefate sa binary ...

Bala haholoanyane

eBay Queue Lipotso

Potso ea 61. Binary Tree odara ka mokhoa oa zigzag Ho tsamaea Fuoa sefate sa binary, hatisa tsela ea zigzag ea tatellano ea litekanyetso tsa eona tsa node. (ke hore, ho tloha ka letsohong le letšehali ho ea ho le letona, ho tloha ho le letona ho ea ho le letšehali bakeng sa boemo bo latelang ebe o chencha pakeng tsa) Mohlala nahana ka sefate sa binary se fanoeng ka tlase ka tlase ke ho putlama ha maemo a zigzag ho mefuta e kaholimo ea sefate sa binary ...

Bala haholoanyane

eBay Matrix Lipotso

Potso ea 62. Tharollo ea Lentsoe Leetcode Tharollo Polelo ea Bothata Ha u fuoa boto ea mxn le lentsoe, fumana hore na lentsoe le teng ho grid. Lentsoe lena le ka hahuoa ho tsoa ho litlhaku tsa lisele tse haufi tse latellanang, moo lisele tse "haufi" li bapileng le tse ling. Sele e tšoanang ea lengolo e kanna ea se sebelisoe makhetlo a fetang a le mong. Mohlala ...

Bala haholoanyane

eBay Lipotso tse ling

Potso ea 63. Tharollo ea LeetCode ea Nomoro ea Fibonacci Polelo ea Bothata Tharollo ea LeetCode ea Fibonacci - "Nomoro ea Fibonacci" e bolela hore Linomoro tsa Fibonacci, tse atisang ho hlalosoa F (n) li etsa tatellano, e bitsoang tatellano ea Fibonacci, e le hore palo ka 'ngoe e be kakaretso ea tse peli tse fetileng, ho tloha ho 0 le 1. Ke hore, F(0) = 0, F(1) = 1 F(n) = F(n - 1) + F(n ...

Bala haholoanyane

Potso ea 64. Fetola Mantsoe ka Tharollo ea LeetCode ea Mohala oa III Phatlalatso ea Bothata e Fetola Mantsoe ka Tharollo ea LeetCode ea String III - Re fuoa khoele 'me re kōptjoa ho fetola tatellano ea litlhaku lentsoeng le leng le le leng ka har'a polelo ha re ntse re boloka sebaka se tšoeu le tatellano ea mantsoe a pele. Mehlala & Litlhaloso Mohlala 1: Kenyeletso: s = "Ha re nke LeetCode ...

Bala haholoanyane

Potso ea 65. Tlosa Likopi ho Tharollo ea LeetCode e Hlophisitsoeng Phatlalatso ea Bothata Tlosa Likopi ho tsoa Lethathamong le Hlophisitsoeng Tharollo ea LeetCode - Re fuoa hlooho ea lethathamo le hlophisitsoeng le kopantsoeng. Re kopuoa ho hlakola likopi tsohle tsa hore ntho e 'ngoe le e 'ngoe e hlahe hanngoe feela ebe re khutlisa lethathamo le hlophisitsoeng le hlophisitsoeng. Mehlala & Litlhaloso Mohlala 1: Kenyeletso: hlooho ...

Bala haholoanyane

Potso ea 66. Hlakola Binary Tree LeetCode Tharollo Polelo ea Bothata: Invert Binary Tree LeetCode Solution - Potsong ena, Ho fanoe ka motso oa sefate leha e le sefe sa binary, ho hlokahala tharollo ho khelosa sefate sa binary se bolelang hore sefate se letšehali se lokela ho fetoha sefate se nepahetseng le ka tsela e fapaneng. Tlhaloso Re ka ipotsa hore na ke tsela efe ea sefate e ka bang ...

Bala haholoanyane

Potso ea 67. N-Queens LeetCode Tharollo Bothata Polelo ea N-Queens LeetCode Tharollo - The n-queens puzzle ke bothata ba ho beha n queens holim'a nxn chessboard hore ho se ke ha e-ba le mafumahali a mabeli a hlaselang. Ho latela palo e felletseng ea n, khutlisetsa litharollo tsohle tse fapaneng ho puzzle ea n-queens. O ka khutlisa karabo ka tatellano efe kapa efe. Tharollo e 'ngoe le e' ngoe e na le tlhophiso e ikhethileng ea boto ea ...

Bala haholoanyane

Potso ea 68. Rectangle e Khōlō ka ho Fetisisa ho Histogram LeetCode Tharollo Polelo ea Bothata Rectangle e Khōlō ka ho Fetisisa ho Histogram LeetCode Tharollo – Ha ho fanoe ka palo e fapaneng ea bophahamo ba litopo tse emelang bophahamo ba bar ea histogram moo bophara ba bar e 'ngoe le e 'ngoe e leng 1, khutlisetsa sebaka sa khutlonnetsepa e kholo ka ho fetisisa ho histogram. Mohlala oa Tlhahlobo ea 1: Kenyelletso: bophahamo = [2, 1, 5, 6, 2, 3] Sephetho: 10 Tlhaloso: ...

Bala haholoanyane

Potso ea 69. Mantsoe a Tloaelehileng a Matching Kamehla Matching Matching LeetCode Tharollo Polelo ea Mathata Matching a Tloaelehileng a Matching Regular Expression Matching LeetCode Tharollo - Ho fanoe ka khoele ea ho kenya s le mohlala p, kenya ts'ebetsong mokhoa o tloaelehileng oa ho bapisa le tšehetso bakeng sa '.' le '*' moo: '.' E tsamaellana le tlhaku e le 'ngoe.​​'*' E tsamaellana le zero kapa ho feta tsa elemente e tlang pele. Ho bapisa ho lokela ho koahela khoele eohle ea ho kenya (eseng leeme). Mohlala oa 1 oa Teko: Kenyeletso: ...

Bala haholoanyane

Potso ea 70. Binary Tree Right Side View LeetCode Tharollo Polelo ea Bothata Binary Tree Right Side View LeetCode Tharollo - Ho fanoe ka motso oa sefate sa binary, ipone u eme ka lehlakoreng le letona la eona, 'me u khutlisetse litekanyetso tsa li-node tseo u ka li bonang li laetsoe ho tloha holimo ho ea tlaase. Mohlala oa Tlhahlobo ea 1: Kenyo: motso = [1, 2, 3, null, 5, null, ...

Bala haholoanyane

Potso ea 71. Fumana Median ho tsoa ho Data Stream LeetCode Solution Phatlalatso ea Bothata Fumana Median ho tswa ho Data Stream LeetCode Tharollo - Bohareng ke boleng ba bohareng ba lenane la palo e hlophisitsoeng. Haeba boholo ba lenane bo lekana, ha ho na boleng bo bohareng 'me bohareng ke moelelo oa litekanyetso tse peli tse bohareng. Mohlala, bakeng sa arr = [2,3,4], median ...

Bala haholoanyane

Potso ea 72. Optimal Account Balancing LeetCode Tharollo Problem Statement Optimal Account Balancing LeetCode Solution - U fuoa mefuta e mengata ea transactions moo transaction[i] = [from, toi, amounti] e bonts'ang hore motho ea nang le ID = fromi o fane ka amounti $ ho motho ea nang le ID = toi. Khutlisetsa bonyane palo ea lik'hamphani tse hlokahalang ho lefa sekoloto. Kenyelletso: transactions = [[0,1,10],[2,0,5]] Sephetho: 2 Tlhaloso: Motho #0 ...

Bala haholoanyane

Potso ea 73. Kopanya le Deserialize Binary Tree LeetCode Tharollo Problem Statement Serialize and Deserialize Binary Tree LeetCode Solution - Serialization ke ts'ebetso ea ho fetolela sebopeho sa data kapa ntho hore e be tatellano ea likotoana e le hore e ka bolokoa faeleng kapa buffer ea memori, kapa e fetisetsoe ka har'a sehokelo sa khokahano ea marang-rang se tla tsosolosoa hamorao. ka...

Bala haholoanyane

Potso ea 74. Binary Tree Zigzag Level Order Traversal LeetCode Tharollo Polelo ea Bothata Binary Tree Zigzag Level Order Traversal LeetCode Tharollo - Ka lebaka la motso oa sefate sa binary, khutlisetsa boemo ba zigzag ho potoloha ha boleng ba li-node tsa eona. (ke hore, ho tloha ho le letšehali ho ea ho le letona, ebe ho le letona ho ea ho le letšehali bakeng sa boemo bo latelang le ho fapanyetsana pakeng tsa). Kenyelletso: motso = [3,9,20,null,null,15,7] Output: [[3],[20,9],[15,7]] Tlhaloso Re ...

Bala haholoanyane

Potso ea 75. Fumana Tharollo ea LeetCode ea Duplicate Number Phatlalatso ea Bothata Fumana Tharollo ea LeetCode ea Palo E 'meli - Ho fanoe ka palo ea palo e kholo e nang le linomoro tsa n + 1 moo palo e 'ngoe le e 'ngoe e leng ho mefuta [1, n] e kenyellelitsoeng. Ho na le palo e le 'ngoe feela e phetoang ka lipalo, khutlisetsa palo ena e phetiloeng. O tlameha ho rarolla bothata ntle le ho fetola palo ea palo mme o sebelise sebaka se eketsehileng feela. Kenyelletso: lipalo = [1,3,4,2,2] Sephetho: 2 Tlhaloso ...

Bala haholoanyane

Potso ea 76. Element e sieo ho Tharollo e Hlophisitsoeng ea LeetCode Polelo ea Bothata: Element e sieo ka har'a Array Array LeetCode Tharollo - Ho fanoe ka palo e felletseng ea palo e hlophisoang ka tatellano e nyolohang 'me likarolo tsohle tsa eona li ikhethile 'me li fanoe hape ka palo ea k, khutlisetsa kth nomoro e sieo ho tloha ho palo e ka ho le letšehali ea lenane. Mohlala: Mohlala 1 Kenyeletso: lipalo = [4,7,9,10], k = ...

Bala haholoanyane

Potso ea 77. Alien Dictionary LeetCode Tharollo Polelo ea Bothata Tharollo ea Alien Dictionary LeetCode - Ho na le puo e ncha esele e sebelisang alfabeta ea Senyesemane. Leha ho le joalo, taelo har'a mangolo ha e tsejoe ho uena. U fuoa lethathamo la mantsoe a likhoele a tsoang bukeng e hlalosang mantsoe a puo esele, moo likhoele tsa mantsoe li hlophisoang ho latela melao ea puo ena e ncha. ...

Bala haholoanyane

Potso ea 78. Sehlahisoa sa Array Ntle le Tharollo ea Self LeetCode Sehlahisoa sa Bothata Sehlahisoa sa Array Ntle le Tharollo ea Self LeetCode - Ho fanoe ka palo e feletseng ea palo, khutlisetsa karabo e fapaneng hoo karabo[i] e lekanang le sehlahisoa sa likarolo tsohle tsa lipalo ntle le linomoro[i]. Sehlahisoa sa sehlongoapele leha e le sefe kapa sehlongoana sa linomoro se tiisitsoe hore se tla lekana palo e feletseng ea 32-bit. U tlameha ho ngola algorithm e tsamaeang ka nako ea O(n) ntle le ho sebelisa karohano ...

Bala haholoanyane

Potso ea 79. Moralo Skiplist LeetCode Tharollo Tlhaloso ea Bothata Boqapi Skiplist LeetCode Tharollo - Rala Skiplist ntle le ho sebelisa lilaeborari tse hahiloeng. Skip list ke sebopeho sa data se nkang O(log(n)) nako ho kenya, ho hlakola le ho batla. Ha ho bapisoa le sefate le sefate se sefubelu-botšo se nang le ts'ebetso le ts'ebetso e ts'oanang, bolelele ba khoutu ea Skiplist bo ka bapisoa ...

Bala haholoanyane

Potso ea 80. Likamano tsa Manane a Mabeli a Kopantsoeng Tharollo ea LeetCode Phatlalatso ea Phatlalatso ea Bothata ba Manane a Mabeli a Kopantsoeng Tharollo ea LeetCode - Re fuoa lihlooho tsa lihlooho tse peli tse hokahaneng ka matla hloohoA le hloohoB. Ho boetse ho fanoe ka hore manane a mabeli a hokahantsoeng a ka 'na a kopana ka nako e itseng. Re kopuoa ho khutlisa node eo ba kopanang ho eona kapa ba se nang letho haeba ...

Bala haholoanyane

Potso ea 81. Fetola Sets'oants'o sa LeetCode Tharollo Polelo ea Bothata Rotate Image LeetCode Solution - U fuoa nxn 2D matrix e emelang setšoantšo, potoloha setšoantšo ka likhato tse 90 (ho ea ka nako). U tlameha ho potoloha setšoantšo sebakeng, ho bolelang hore u tlameha ho fetola matrix a 2D ka kotloloho. U SE KE UA fana ka matrix e 'ngoe ea 2D ebe u potoloha. Mohlala oa 1 oa Teko: Kenyeletso: ...

Bala haholoanyane

Potso ea 82. Peeking Iterator LeetCode Tharollo Polelo ea Bothata Peeking Iterator LeetCode Tharollo - Etsa moralo o tšehetsang ts'ebetso ea peek ho iterator e teng ho phaella ho hasNext le ts'ebetso e latelang. Kenya ts'ebetsong sehlopha sa PeekingIterator: PeekingIterator(Iterator nums) E qala ntho ka kakaretso e fanoeng e pheta-phetoang. int next() E khutlisetsa ntho e latelang lethathamong ebe e tsamaisa pointer ho karolo e latelang. boolean...

Bala haholoanyane

Potso ea 83. Kth Ntho e Nyane ka ho Fetisisa ka Tharollo ea Leetcode ea BST Polelo ea Bothata Kth Ntho e Nyenyane ka ho Fetisisa Tharollo ea Leetcode ea BST - Ho fanoe ka motso oa sefate sa lipatlisiso sa binary, le palo e feletseng ea k, khutlisetsa kth e nyenyane ka ho fetisisa (1-indexed) ea litekanyetso tsohle tsa li-node sefateng. Mehlala: Kenyeletso: motso = [3,1,4,null,2], k = 1 Output: 1 Input: root = [5,3,6,2,4,null,null,1], k ...

Bala haholoanyane

Potso ea 84. Fumana Makhasi a Binary Tree LeetCode Tharollo Polelo ea Bothata Fumana Makhasi a Binary Tree LeetCode Tharollo - Ho fanoe ka motso oa sefate sa binary, bokella li-node tsa sefate joalokaha eka u etsa sena: Bokella makhasi ohle a makhasi. Tlosa li-node tsohle tsa makhasi. Pheta ho fihlela sefate se se na letho. Mohlala oa 1 oa Teko: Kenyo: motso = [1, 2, 3, ...

Bala haholoanyane

Potso ea 85. Kopanya Array LeetCode Tharollo e Hlophisitsoeng Polelo ea Bothata Kopanya Array Array LeetCode Tharollo - U fuoa lihlopha tse peli tse felletseng tse nums1 le nums2, tse hlophisitsoeng ka tatellano e sa theoheng, le linomoro tse peli m le n, tse emelang palo ea likarolo ho nums1 le nums2 ka ho latellana. Kopanya nums1 le nums2 ho sehlopha se le seng se hlophisitsoeng ka tatellano e sa theoheng. Sehlopha sa ho qetela se hlophiloeng ha sea lokela ho khutlisoa ke mosebetsi, empa se bolokoe ka har'a lethathamo la nums1. ...

Bala haholoanyane

Potso ea 86. Palo ea Lihlekehleke Tse Ikhethileng Tharollo ea Leetcode Polelo ea Bothata Palo ea Lihlekehleke Tse Ikhethileng Tharollo ea LeetCode - "Palo ea Lihlekehleke Tse Ikhethileng" e bolela hore ho fanoe ka anxm binary matrix. Sehlekehleke ke sehlopha sa 1's (e emelang naha) e hokahaneng ka 4-directionally (e rapameng kapa e otlolohileng). Sehlekehleke se nkoa se tšoana le se seng haeba feela sehlekehleke se le seng ...

Bala haholoanyane

Potso ea 87. Khoele Compression LeetCode Tharollo Tlhaloso ea Bothata Tharollo ea Khoele ea Khatello ea LeetCode - Ho fanoe ka mefuta e mengata ea litlhaku, e hatelle u sebelisa algorithm e latelang: Qala ka khoele e se nang letho s. Bakeng sa sehlopha se seng le se seng sa litlhaku tse pheta-phetoang ka li-char: Haeba bolelele ba sehlopha e le 1, kopanya sebapali ho se. Ho seng joalo, eketsa sebapali se lateloang ke bolelele ba sehlopha. Khoele e hatelitsoeng ...

Bala haholoanyane

Potso ea 88. Palo ea Liprofinse Tharollo ea Leetcode Polelo ea Bothata Palo ea Liprofinse Leetcode Tharollo - Re fuoa boemeli ba matrix a adjacency ea graph mme re hloka ho fumana palo ea liprofinse. Mona profinse ke sehlopha sa litoropo tse hokahaneng ka kotloloho kapa ka tsela e sa tobang 'me ha ho litoropo tse ling kantle ho sehlopha. Mohlala oa 1: Kenyeletso: isConnected ...

Bala haholoanyane

Potso ea 89. Tharollo e sa fokotseng ea Array LeetCode Polelo ea Bothata Ha e fokotsehe Tharollo ea Array LeetCode - ho fanoe ka lipalo tse ngata tse nang le n integers, mosebetsi oa hau ke ho hlahloba hore na e ke ke ea fokotseha ka ho fetola ntho e le 'ngoe. Re hlalosa lenane ha le fokotsehe haeba nums[index ] <= nums[index +1] e ts'oara bakeng sa index e' ngoe le e 'ngoe (0-based) e le hore (0 <= index <= n-2). ...

Bala haholoanyane

Potso ea 90. Fokotsa Maximum Pair Sum in Array LeetCode Solution Polelo ea Bothata Fokotsa Maximum Pair Sum in Array LeetCode Solution e re kakaretso ea para (a,b) e lekana le a+b. Kakaretso ea lipara ke chelete e kholo ka ho fetisisa lethathamong la lipara. Mohlala, haeba re na le lipara (2,6), (1,3), le (5,4), kakaretso ea kakaretso ea lipara e tla ba max(2+6, ...

Bala haholoanyane

Potso ea 91. Khalendara ea ka I LeetCode Tharollo Polelo ea Bothata Khalendara ea Ka I LeetCode Tharollo - Re hloka ho ngola lenaneo le ka sebelisoang e le Khalendara. Re ka kenya ketsahalo e ncha haeba ho kenya ketsahalo ho ke ke ha etsa hore peheletso e habeli. Ho etsa kopo habeli ho etsahala ha liketsahalo tse peli li na le mateano a litsela a se nang letho (ke hore, motsotso o itseng ke ...

Bala haholoanyane

Potso ea 92. Likamore tsa Kopano II Tharollo ea LeetCode Polelo ea Bothata Likamore tsa Kopano II LeetCode Tharollo - "Likamore tsa Kopano II" li bolela hore u fuoa letoto la linako tsa nako ea liboka "likhao" moo "linako[i] = [ qala[i], qetellong[i] ]", khutlisetsa bonyane palo ea likamore tsa kopano e hlokahalang. Mohlala: linako = [[0,30],[5,10],[15,20]] 2 Tlhaloso: Ho kopana ho ka etsoa ...

Bala haholoanyane

Potso ea 93. LRU Cache LeetCode Tharollo Lipotso Rala sebopeho sa data se latelang litšitiso tsa cache e sa tsoa Sebelisoa Haufinyane (LRU). Kenya tšebetsong sehlopha sa LRUCache: LRUCache(int capacity) Qala cache ea LRU ka boholo bo nepahetseng. int get(int key) Khutlisa boleng ba senotlolo haeba senotlolo se teng, ho seng joalo khutlisetsa -1. void put(int key, int value) Ntlafatsa boleng ba senotlolo haeba senotlolo se le teng. Ho seng joalo, eketsa li-key-value pair ho ...

Bala haholoanyane

Potso ea 94. Kth Element e Kholo ka ho Fetisisa Tharollong ea Leetcode Polelo ea Bothata Bothateng bona, re tlameha ho rala sehlopha sa KthLargest () seo qalong se nang le palo e kholo ea k le palo ea linomoro. Re hloka ho ngola sehahi sa parameter bakeng sa eona ha palo e kholo ea k le li-num tse ngata li fetisoa joalo ka likhang. Sehlopha se boetse se na le mosebetsi add (val) o eketsang ...

Bala haholoanyane

Potso ea 95. Pow (x, n) Tharollo ea Leetcode Bothata "Pow (x, n) Tharollo ea Leetcode" e re o fuoa linomoro tse peli, e 'ngoe ea tsona ke palo ea lintlha tse phaphamalang mme e' ngoe ke palo e felletseng. Kakaretso e bolela sehlahisoa mme setsi ke palo ea ntlha e phaphametseng. Re bolelloa hore re fumane boleng kamora ho lekola sebapali ka holim'a setsi. ...

Bala haholoanyane

Potso ea 96. Tharollo Leetcode Tharollo Bothata ba Permutations Tharollo ea Leetcode e fana ka tatellano e bonolo ea linomoro mme e re kopa ho khutlisa vector e felletseng kapa tatellano ea tumello eohle ea tatellano e fanoeng. Kahoo, pele o rarolla bothata. Re lokela ho tloaelana le tumello. Kahoo, tumello ha se letho haese tokisetso ...

Bala haholoanyane

Potso ea 97. Tharollo ea Leetcode ea Ntlo ea Robber II Bothateng ba "House Robber II", lesholu le batla ho utsoetsa chelete matlong a fapaneng. Palo ea chelete e matlong e emeloa ka bongata. Re hloka ho fumana palo e kaholimo ea chelete e ka etsoang ka ho eketsa likarolo ka tatellano e fanoeng ho latela ...

Bala haholoanyane

Potso ea 98. K-th e khetholla karolo ka tatellano U fuoa lenane le felletseng la A, hatisa k-th element e ikhethileng ka tatellano. Sehlopha se fanoeng se ka ba le likopi mme sehlahisoa se lokela ho hatisa k-th e ikhethang har'a likarolo tsohle tse ikhethileng ka tatellano. Haeba k e feta likarolo tse 'maloa tse ikhethileng, e tlalehe. Keletso ea Mohlala: ...

Bala haholoanyane

Potso ea 99. Litumello tsa Leetcode Bothateng bona ba bothata ba leetcode re fane ka linomoro tse ngata tse fapaneng, hatisa litumello tsohle tse teng. Mehlala Input arr [] = {1, 2, 3} Tlhahiso 1 2 3 1 3 2 2 1 3 2 3 1 3 1 2 3 2 1 Input arr [] = {1, 2, ...

Bala haholoanyane

Potso ea 100. Merge K Mananeo a Kopaneng a Kopaneng Kopanya K e hlophisitsoeng lethathamong le thathamisitsoeng bothata e tsebahala haholo ho latela pono ea lipotso. Potso ena e botsa makhetlo a mangata likhamphaning tse kholo joalo ka Google, Microsoft, Amazon, jj. Re tlameha ho li kopanya hore e be ...

Bala haholoanyane

Potso ea 101. Phallo ea Lentsoe Word Break ke bothata bo bonts'ang mohopolo o mocha ka botlalo. Bohle re utloile ka mantsoe a kopaneng. Mantsoe a entsoe ka mantsoe a fetang a mabeli. Kajeno re na le lethathamo la mantsoe mme sohle seo re tlamehang ho se etsa ke ho sheba hore na mantsoe ohle a tsoang ho bukantswe a ka ...

Bala haholoanyane

Potso ea 102. 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 103. Iketsetse 'me u nyenyefatse Sefate sa Binary Re fane ka sefate sa binary se nang le linomoro tsa N moo node ka 'ngoe e nang le boleng bo itseng. Re hloka ho etsa serialize le des desize sefate binary. SerializeTs'ebetso ea ho boloka sefate faeleng ntle le ho senya sebopeho sa eona e bitsoa serialization. Iketsetse le ho nyenyefatsa Sefate sa Binary Ts'ebetso ...

Bala haholoanyane

Translate »