Lipotso tsa Puisano ea Adobe Coding

Lipotso tsa Adobe Array

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. Karohano ho K Equal Sum Subsets Leetcode Tharollo Polelo ea Bothata Karolo ea K Equal Sum Subsets LeetCode Solution - "Partition to K Equal Sum Subsets" e re o filoe palo e felletseng ea lipalo le palo ea k, khutlela 'nete haeba ho khonahala ho ba le k li-subsets tse se nang letho tseo lipalo tsa tsona li leng teng. kaofela lia lekana. Mohlala: Kenyelletso: lipalo = [4,3,2,3,5,2,1], k = 4 Sephetho: ...

Bala haholoanyane

Potso ea 3. Phetoho ea Chelete ea 2 Tharollo ea Leetcode Polelo ea Bothata Phetoho ea Chelete ea Lichelete 2 Tharollo ea LeetCode - "Chelete ea Chelete ea Chelete ea 2" e bolela hore ho fanoe ka mefuta e mengata ea lichelete tsa tšepe tse fapaneng le palo e feletseng, e emelang chelete eohle. Re hloka ho khutlisa palo ea palo eohle ea metsoako e fapaneng e ka bang teng ho palo eo. ...

Bala haholoanyane

Potso ea 4. Frog Jump Leetcode Tharollo Polelo ea Bothata The Frog Jump LeetCode Solution - "Frog Jump" e bolela hore ho fanoe ka lethathamo la majoe (maemo) a hlophisitsoeng ka tatellano ea ho nyoloha, etsa qeto ea hore na frog e ka tšela nōka ka ho lula holim'a lejoe la ho qetela ( index ea ho qetela ea sehlopha). Qalong, senqanqane se holim'a lejoe la pele mme ...

Bala haholoanyane

Potso ea 5. Haha Array From Permutation Leetcode Tharollo Polelo ea Bothata The Build Array From Permutation LeetCode Solution - "Build Array From Permutation" e bolela hore ho fanoe ka lipalo tsa tumello tse thehiloeng ho zero, re tlameha ho haha ​​​​lethathamo la bolelele bo lekanang moo ans[i] = nums[nums[i]] bakeng sa e 'ngoe le e 'ngoe. ke sebakeng [0,nums.length-1]. Lipalo tsa tumello tse thehiloeng ho zero ke palo e fapaneng e fapaneng ho tloha ho 0 ...

Bala haholoanyane

Potso ea 6. Theko e tlase ea Litekete Tharollo ea Leetcode Phatlalatso ea Bothata Chelete e Bonyane bakeng sa Litekete Tharollo ea LeetCode - "Bonyane Chelete ea Litekete" e u kopa hore u fumane bonyane ba lidolara tseo u li hlokang ho tsamaea letsatsi le leng le le leng lethathamong le fanoeng la matsatsi. U tla fuoa palo e felletseng ea matsatsi. Letsatsi le leng le le leng ke palo e felletseng ho tsoa ho ...

Bala haholoanyane

Potso ea 7. Beha Tharollo ea Leetcode ea Matrix Zeroes Polelo ea Bothata The Set Matrix Zeroes LeetCode Solution – “Set Matrix Zeroes” e bolela hore u filoe mxn integer matrix. ho ea 0. U tlameha ho e etsa ka ...

Bala haholoanyane

Potso ea 8. Tharollo ea Leetcode ea Nomoro e sieo Phatlalatso ea Bothata Tharollo ea Nomoro e Fokohileng ea LeetCode - "Nomoro e sieo" e bolela hore ho fanoe ka palo ea boholo ba n e nang le linomoro tse fapaneng pakeng tsa [0,n]. Re hloka ho khutlisa nomoro e sieo sebakeng sa marang-rang. Mohlala: Input: nums = [3,0,1] Output: 2 Tlhaloso: Re ka hlokomela ha bonolo hore tsohle ...

Bala haholoanyane

Potso ea 9. Phunya Tharollo ea Letoto la Leetcode Bothata ba ho Sokisa Array Leetcode Solution bo re fa bolelele ba bolelele ba 2n. Mona 2n e bolela hore bolelele ba bolelele bo lekana. Ka mor'a moo re bolelloa hore re qhekelle sehlopha. Mona ho sisinyeha ha ho bolele hore re hloka ho hlophisa lethathamo ka mokhoa o ikhethileng empa tsela e ikhethang ke ...

Bala haholoanyane

Potso ea 10. Tharollo ea 3Sum Leetcode Polelo ea Bothata Ho fanoe ka linomoro tse ngata, na ho na le likarolo a, b, c ka li-nums joalo ka hore a + b + c = 0? Fumana li-triplets tsohle tse ikhethileng ka har'a sehlopha se fanang ka kakaretso ea zero. Tlhokomeliso: hore tharollo e se ke ea ba le mafahla a mararo. Mohlala # 1 [-1,0,1,2, -1,4] ...

Bala haholoanyane

Potso ea 11. 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 12. Boholo ba Tlatsetso ea Leetcode Tharollo Polelo ea Bothata Ha u fuoa linomoro tse ngata tse fapaneng, fumana sehlahisoa se kopaneng (se nang le bonyane palo e le 'ngoe) se nang le palo e kholo ka ho fetisisa ebe se khutlisa kakaretso ea sona. Mohlala nums = [-2,1, -3,4, -1,2,1, -5,4] 6 Tlhaloso: [4, -1,2,1] e na le kakaretso e kholo ka ho fetisisa = 6. nums = [- 1] -1 Atamela 1 (Arola le ho Hlōla) Ka mokhoa ona ...

Bala haholoanyane

Potso ea 13. Find N Unique Integers Sum up to Zero Leetcode Tharollo Bothata ba Find N Unique Integers bo akaretsa Zero Leetcode Solution, e re fang palo e felletseng. E re kopa ho khutlisa linomoro tse ikhethang tse akaretsang ho 0. Kahoo, potso e bonolo ho e utloisisa. Kahoo, pele o kenella ka har'a tharollo. Ha re shebeng ...

Bala haholoanyane

Potso ea 14. Fumana Tharollo ea Batho ba Tloaelehileng ea Leetcode Polelo ea Bothata Bothateng bona, re fuoa likhoele tse ngata. Re hloka ho hatisa lethathamo la litlhaku tsohle tse hlahang khoeleng e 'ngoe le e' ngoe ka har'a lethathamo (likopi li kenyelelitsoe). Ke hore ha sebopeho se hlaha makhetlo a mabeli khoeleng e ngoe le e ngoe, empa eseng makhetlo a 2, re hloka ho ba le eona ...

Bala haholoanyane

Potso ea 15. Fumana Linomoro Tsohle Tse Nyametseng ka Tharollo ea Leetcode Tharollo Polelo ea Bothata bothateng bona, re fuoa mefuta e mengata ea linomoro. E na le likarolo tse tsoang ho 1 ho ea ho N, moo N = boholo ba sehlopha. Leha ho le joalo, ho na le likarolo tse ling tse nyametseng mme tse ling tsa likopi li teng sebakeng sa tsona. Morero oa rona ke ho khutlisa sehlopha ...

Bala haholoanyane

Potso ea 16. Tharollo ea Leetcode ea bongata ba Element II Bothateng bona, re fuoa mefuta e mengata ea linomoro. Morero ke ho fumana likarolo tsohle tse etsahalang ho feta nako ea /N / 3⌋ ka bongata moo N = boholo ba sehlopha le ⌊ ⌋ e leng mosebeletsi oa mokatong. Re hloka ho khutlisa mefuta e mengata ea ...

Bala haholoanyane

Potso ea 17. 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 18. Tharollo e Ikhethileng ea Leetcode Tharollo Bothata ba Unique Paths Leetcode Solution e re o filoe linomoro tse peli tse emelang boholo ba gridi. Ho sebelisa boholo ba gridi, bolelele le bophara ba gridi. Re hloka ho fumana palo ea litsela tse ikhethang ho tloha k'honeng e kaholimo ho le letšehali la gridi ho ea ...

Bala haholoanyane

Potso ea 19. Tharollo ea Matrix Diagonal Sum Leetcode Polelo ea Bothata Bothateng ba Matrix Diagonal Sum ho fanoa ka lipalo tse sekwere tsa linomoro. Re tlameha ho bala kakaretso ea likarolo tsohle tse teng litsing tsa eona tse fapaneng, ke hore, likarolo tse ho diagonal tsa mantlha hammoho le tse mahlakore a mabeli tse fapaneng. Karolo ka 'ngoe e lokela ho baloa hang feela. Mohlala mat = [[1,2,3], [4,5,6], ...

Bala haholoanyane

Potso ea 20. Linomoro tse kae li nyane ho feta tharollo ea nomoro ea Leetcode Polelo ea Bothata Bothateng bona, re fuoa lethathamo. Bakeng sa karolo ka 'ngoe ea sehlopha sena, re tlameha ho fumana palo ea likaroloana tse nyane ho feta elemente eo. ke hore bakeng sa e mong le e i (0 <= i

Bala haholoanyane

Potso ea 21. 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 22. 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 23. Batla Kenya Tharollo Leetcode Tharollo Bothateng bona, re fuoa mefuta e hlophiloeng le palo e lebisitsoeng. Re tlameha ho fumana Search Insert Position. Haeba boleng ba sepheo bo le teng ka bongata, khutlisa index ea eona. Khutlisa index eo sepheo se lokelang ho kenngoa ho eona ho boloka tatellano e hlophisitsoe (ho ...

Bala haholoanyane

Potso ea 24. Ho matha Kakaretso ea 1d Array Leetcode Tharollo Polelo ea Bothata Ha re bala bothata ba lethathamo la 1d re fuoe lipalo tse ngata tseo re tlamehang ho li khutlisa moo bakeng sa index e 'ngoe le e' ngoe sephethong sa tatellano arr [i] = sum (nums [0]… nums [i]) . Mohlala nums = [1,2,3,4] [1,3,6,10] Tlhaloso: Kakaretso ea matha ke: ...

Bala haholoanyane

Potso ea 25. 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 26. 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 27. Beakanya Lethathamo leo hore arr [i]> = arr [j] haeba ke lekana le ho hlophisa [i] <= arr [j] haeba ke makatsa mme j <i Ha re re u na le lenane le lekaneng. Polelo ea bothata e kopa ho hlophisa mabotho ka tsela eo likarolo tse boemong bo tšoanang li lokelang ho ba kholo ho feta likarolo tsohle tse ka pele ho eona mme likarolo tse maemong a makatsang li lokela ho ba tlase ho tsa pele ho eona. Mohlala ...

Bala haholoanyane

Potso ea 28. Ts'ebetso e Nyane ea Tlosa ho etsa Elements tsohle tsa Array Same Ha re re re na le lintlha tse ngata tse nang le "x". Re fane ka bothata ba hore re tlameha ho fumana ts'ebetso ea ho tlosa, e lokelang ho ba bonyane bo hlokehang ho etsa sehlopha se lekanang ke hore, sehlopha se tla ba le likarolo tse lekanang. Keletso ea Mohlala: [1, 1, ...

Bala haholoanyane

Potso ea 29. Liketsahalo tse ngata tsa sehlopha sa likarolo tsa tatellano li laetsoe ke Liketsahalo tsa pele U fuoa potso moo u faneng ka tatellano e sa hlophisoang e nang le lipalo tse ngata. Mosebetsi ke ho hlophisa liketsahalo tse ngata tse fapaneng tse hlophisitsoeng ke ketsahalo ea pele. Khabareng, odara e lokela ho ts'oana le palo e tlang. Keletso ea Mohlala: [2, 3,4,3,1,3,2,4] ...

Bala haholoanyane

Potso ea 30. Beakanya Lethathamo le joalo hore arr [i] e lekane le i "Beakanya lintho tse ngata tse fapaneng hoo arr [i] = i" bothata bo bolelang hore o fuoe mefuta e mengata ea linomoro ho tloha ho 0 ho isa ho n-1. Kaha likarolo tsohle li kanna tsa se be teng ka tatellano, joale sebakeng sa tsona -1 ho na le moo. Polelo ea bothata e kopa ho hlophisa lintho tse ngata joalo ...

Bala haholoanyane

Potso ea 31. Palo e kahodimodimo ea li-chocolate tse tla ajoa ka ho lekana har'a baithuti ba k "Palo e phahameng ea chokolete e lokelang ho ajoa ka ho lekana har'a baithuti ba k" e re o fuoa mabokose a nang le chokolete. Ha re re ho na le baithuti ba k. Mosebetsi ke ho aba palo e phahameng ea chokolete har'a baithuti ba k ka ho lekana, ka ho khetha mabokose a latellanang. Re ka khona ...

Bala haholoanyane

Potso ea 32. Linomoro tse phahameng ka ho fetisisa tse latellanang li teng ka tatellano Polelo ea Bothata A re re u na le mefuta e mengata ea boholo ba N. Bothata "Linomoro tse ngata tse latellanang tse teng ka bongata" li kopa ho fumana palo e holimo ea linomoro tse latellanang tse ka hasantsoeng ka bongata. Mohlala arr [] = {2, 24, 30, 26, 99, 25} 3 Tlhaloso: The ...

Bala haholoanyane

Potso ea 33. Fumana likopi ka har'a sehlopha se fanoeng ha likarolo li sa lekanyetsoe ho mefuta Bothata "Fumana likopi tse 'maloa ka tatellano e fanoeng ha likarolo li sa lekanyetsoe ho mefuta" e re o na le sehlopha se nang le linomoro tse ngata. Polelo ea bothata eona ho fumana likarolo tse kopitsoang haeba li le teng ka har'a sehlopha. Haeba ho se na ntho e joalo khutla -1. Mohlala [...

Bala haholoanyane

Potso ea 34. Nako e Ntle ea ho Reka le ho Rarolla Tharollo ea Leetcode ea Stock III Polelo ea bothata Bothateng ba "Nako e Ntle ea ho Reka le ho Rekisa Stock III," re fuoa lethathamo moo karolo ka 'ngoe sehlopheng sena e nang le theko ea setoko se fanoeng ka letsatsi leo. Tlhaloso ea thekiso ke ho reka karolo e le 'ngoe ea setoko le ho e rekisa ...

Bala haholoanyane

Potso ea 35. Bolelele ba sejana se seholohali se nang le likarolo tse ikopantseng Bothata "Bolelele ba subarray e kholo ka ho fetisisa e nang le likarolo tse ikopantseng" e re o fuoe lenane le le leng. Polelo ea bothata e kopa ho fumana bolelele ba sehlopha se selelele ka ho fetesisa sa likarolo tse ka hlophisoang ka tatellano (e tsoelang pele, ekaba ea nyoloha kapa e theoha). Linomoro ho ...

Bala haholoanyane

Potso ea 36. Boholo ba Litsela ho Array Bothata "Maximum Distance in Array" e re o fuoe "n" no. ea li-arrays le li-arrays tsohle li fanoa ka tatellano e nyolohang. Mosebetsi oa hau ke ho fumana phapang e kholo / phapang e felletseng ea linomoro tse peli ka tatellano mme re ka hlalosa sebaka se selelele lipakeng tsa linomoro tse peli e le ...

Bala haholoanyane

Potso ea 37. E na le lefahla Re fuoe lethathamo mme e kanna eaba e na le likarolo tse tšoanang kapa mohlomong ha ho joalo. Kahoo re hloka ho sheba hore na e na le lefahla. Mehlala [1, 3, 5, 1] ​​'nete ["apole", "mango", "lamunu", "mango"] ke' nete [22.0, 4.5, 3.98, 45.6, 13.54] Mokhoa o fosahetseng Re ka hlahloba bongata ka litsela tse 'maloa ...

Bala haholoanyane

Potso ea 38. Subset Sum Bothata sebakeng sa O (kakaretso) Polelo ea Bothata Bothata ba "Subset sum in O (sum)" bo re o fuoe lethathamo la linomoro tse seng mpe le boleng bo itseng. Joale fumana hore na ho na le subset eo chelete ea eona e lekanang le ea boleng bo kentsoeng. Mohlala oa Array = {1, 2, 3, 4} ...

Bala haholoanyane

Potso ea 39. Fumana Index ea Bracket e Koalang bakeng sa Bracket e Bulehileng e Bontšitsoeng ka Tlhaloso Polelo ea Bothata e fuoe khoele ea bolelele / boholo n le boleng bo boholo bo emelang index ea bracket ea ho bula. Fumana lenane la ho koala bracket bakeng sa bracket e bulehileng e fanoeng ka polelo. Mohlala s = "[ABC [23]] [89]" index = 0 8 s = "[C- [D]]" index = 3 5 s ...

Bala haholoanyane

Potso ea 40. 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 41. Phunya linomoro tse peli tsa bobeli e le a2-b1-a1-b2-a2-b3 - .. bn ntle le ho sebelisa sebaka se eketsehileng Polelo ea Bothata O fuoa linomoro tse ngata. Bothata "Sutle 2n integer as a1-b1-a2-b2-a3-b3 - .. bn without using space extra" e kopa ho hlakola linomoro tsohle tse lenaneng hore linomoro tse (x0, x1, x2, x3, y0, y1, y2, y3) e tla hlakoloa joalo ka x0, y0, ...

Bala haholoanyane

Potso ea 42. Nako e nyane e hlokahalang ho bola lilamunu tsohle Polelo ea Bothata Bothata "Nako e nyane e hlokahalang ho bola lilamunu tsohle" e re o fuoe sehlopha sa 2D, sele e ngoe le e ngoe e na le e 'ngoe ea litekanyetso tse tharo tse ka bang 0, 1 kapa 2. 0 e bolela sele e se nang letho. 1 e bolela lamunu e ncha. 2 e bolela lamunu e bolileng. Haeba se bolileng ...

Bala haholoanyane

Potso ea 43. Fumana bonyane bo hlophisitsoeng ka tatellano Polelo ea Bothata "Fumana Bonyane ka Lenane le hlophisitsoeng le hlophisitsoeng" e re o fuoe boholo ba boholo ba n bo potolohang ho index e itseng. Fumana bonyane ba elemente ka tatellano. Mohlala a [] = {5, 1, 2, 3, 4} 1 Tlhaloso: Haeba re hlophisa lethathamo ka tatellano ...

Bala haholoanyane

Potso ea 44. Fumana palo e tlase ea ts'ebetso ea ho kopanya ho etsa palindrome e ngata Polelo ea Bothata O fuoa linomoro tse ngata. Polelo ea bothata e kopa ho fumana palo e tlase ea ts'ebetso ea ho kopanya ho etsa palindrome e fapaneng, ke hore, fumana palo e tlase ea ts'ebetso ea ho kopanya e lokelang ho etsoa ka har'a sehlopha ho e etsa palindrome. Ho kopanya ts'ebetso ho bolela feela hore ...

Bala haholoanyane

Potso ea 45. Fokotsa phapang e kholo lipakeng tsa libaka tse phahameng Polelo ea Bothata U fuoa bophahamo ba litora le palo k. Re ka eketsa bophahamo ba tora ka k kapa ra fokotsa bophahamo ka k, empa hanngoe feela. Polelo ea bothata e kopa ho fokotsa phapang e phahameng lipakeng tsa libaka tse phahameng. Seo ke ho ...

Bala haholoanyane

Potso ea 46. E hlophisitsoe ka tatellano ho ea ho Banced BST Ka tatellano e hlophisitsoeng ho ba le bothata bo leka-lekaneng ba BST, re fane ka tatellano ka tatellano, re aha Balanced Binary Search Tree ho tloha ho arotsoe. Mehlala Input arr [] = {1, 2, 3, 4, 5} Tlhahiso-pele ea tlhahiso: 3 2 1 5 4 Input arr [] = {7, 11, 13, 20, 22, ...

Bala haholoanyane

Potso ea 47. Boholo ba Square Bothateng bo boholo ba lisekoere re fane ka matrix a 2D a tlatsitsoeng ka 0 le 1, fumana sekoere se seholo se nang le 1 feela, 'me u khutlise sebaka sa eona. Keletso ea mohlala: 1 0 1 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 1 0 XNUMX ...

Bala haholoanyane

Potso ea 48. 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 49. Bohareng ba mefuta e 'meli e hlophisitsoeng E fuoe mefuta e 'meli e arotsoeng A le B ea boholo n le m ka ho latellana. Fumana karolo e bohareng ea sehlopha sa ho qetela se hlophiloeng kamora ho kopanya likarolo tse peli tse fanoeng kapa ka mantsoe a mang, re re fumana mefuta e 'meli e arotsoeng. (Ho rarahana ha nako e lebelletsoeng: O (log (n))) Atamela 1 bakeng sa ...

Bala haholoanyane

Potso ea 50. 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 51. 3 Kakaretso Mathateng a 3 a Sum, re fane ka li-num tse ngata, fumana li-triplets tsohle tse ikhethileng tse akaretsang ho fihlela ho 0. Mohlala Input: nums = {-1, 0, 1, 2, -1, -4} Sephetho: { -1, 0, 1}, {-1, 2, -1} Mokhoa o se nang kelello bakeng sa bothata ba 3 Sum Mokhoa oa matla a Brute ...

Bala haholoanyane

Potso ea 52. Lintho tse ngata khafetsa ka tatellano U fuoa mefuta e mengata ea linomoro. Polelo ea bothata e re o tlameha ho fumana lintlha tse fumanehang khafetsa ka bongata. Haeba ho na le litekanyetso tse ngata tse hlahang ka makhetlo a mangata, re tlameha ho hatisa efe kapa efe ea tsona. Keletso ea mohlala [1, 4,5,3,1,4,16]

Bala haholoanyane

Potso ea 53. Tharollo ea LeetCode ea Metsi a ho Tlisa Pula Bothateng ba LeetCode ea Metsi a Trapping Rain Water, re fane ka linomoro tsa N non-negative tse emelang 'mapa oa bophahamo 'me bophara ba bar e' ngoe le e 'ngoe ke 1. Re tlameha ho fumana bongata ba metsi a ka qabelloang mohahong o ka holimo. Mohlala Ha re utloisise hore ka mohlala Bakeng sa ...

Bala haholoanyane

Potso ea 54. Papali ea Jump Papaling ea ho qhomela re fane ka lethathamo la linomoro tse seng mpe, o qalong o behiloe lenaneng la pele la sehlopha. Karolo e 'ngoe le e' ngoe ea sehlopha e emetse bolelele ba hau ba ho tlola boemong boo. Etsa qeto ea hore na u khona ho fihlela index ea ho qetela. Keletso ea Mohlala: arr = [2,3,1,1,4] ...

Bala haholoanyane

Potso ea 55. 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 56. 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 57. Boholo ba Subarray Mathateng a Maximum Subarray re fane ka li-num tse ngata tse fapaneng, fumana sehlopha se kopaneng se nang le kakaretso e kholo ebe o printa boholo ba boleng ba karolelano. Mohlala oa ho kenya linomoro [] = {-2, 1, -3, 4, -1, 2, 1, -5, 4} Output 6 Algorithm Morero ke ho fumana ...

Bala haholoanyane

Potso ea 58. 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 59. 4Kakaretso Bothateng ba 4Sum, re fane ka palo e kholo x le lenane le [] la boholo n. Fumana sete e ikhethang ea likarolo tse 4 ka tatellano hoo kakaretso ea likarolo tseo tse 4 e lekanang le palo e fuoeng x. Ho Kena Mohlala a [] = {1, 0, -1, ...

Bala haholoanyane

Potso ea 60. Batla Kenya Boemo Bothateng ba Sebaka sa ho Batla ha re Batla, re fane ka palo e kholo ea x le sehlopha se hlophisitsoeng [] ea boholo n. Fumana index e nepahetseng kapa boemo boo palo e fuoeng e lokelang ho kenngoa ho eona haeba e fuoe palo e felletseng, eseng ka bongata. Haeba e fuoe palo e felletseng ka har'a lenane la ho kenya ...

Bala haholoanyane

Potso ea 61. Fumana Peak Element Ha re utloisiseng Fumana bothata ba Peak Element. Kajeno re na le sehlopha se hlokang tlhoro ea sona. Joale, o tlameha o be o ntse o ipotsa hore na ke bolelang ka ntlha ea tlhoro? Karolo ea tlhoro ke e kholo ho feta baahisani bohle ba eona. Mohlala: Ho filoe lethathamo la ...

Bala haholoanyane

Potso ea 62. Lecalcode ea Pascal Triangle Triangle ea Pascal ke bothata bo botle haholo ba Leetcode bo botsoang makhetlo a mangata ho Amazon, Microsoft le lik'hamphaning tse ling. re fane ka mela e mengata e se nang bobe, hatisa mela ea pele ea mela ea triangle ea pascal. Mohlala oa mela = mela e 5 = 6 Mefuta ea tharollo bakeng sa Pascal Triangle Leetcode Dynamic Programming ...

Bala haholoanyane

Potso ea 63. Setshelo le Metsi a mangata Tlhaloso ea bothata: u fuoa linomoro tse ngata (y0, y1, y2… yn-1) ho li-indices (i = 0,1,2… n-1). Kakaretso ea index ea i-th ke yi. Joale, u hula mela ka sefofaneng sa mochini o mong le o mong o hokahanyang (i, yi) le (i, 0). Fumana boholo ba metsi ...

Bala haholoanyane

Potso ea 64. 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 65. Mofuta o potlakileng Mofuta o potlakileng ke mofuta oa algorithm. E fuoe mofuta o sa hlophisoang oe hlophisa o sebelisa mofuta oa algorithm ka potlako. Kakanyo ea Mohlala: {8, 9, 5, 2, 3, 1, 4} Sephetho: {1, 2, 3, 4, 5, 8, 9} Khopolo ke Khokahano le ho Hlōla ho hlophisa Algorithm. E khetha karolo ea pivot ka bongata, e arohana ...

Bala haholoanyane

Potso ea 66. Bothata ba kakaretso ea chelete e kenang Bothateng ba kakaretso ea kakaretso, re fuoa lenane la linomoro tsohle tse nepahetseng le Kakaretso. Re hloka ho lekola hore na ho na le subset eo chelete ea eona e lekanang le kakaretso eo u e filoeng. Mohlala Input Lethathamo la linomoro: 1 2 3 10 5 kakaretso: 9 Tlhaloso ea 'nete Tlhaloso ea ...

Bala haholoanyane

Potso ea 67. 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 68. Boholo ba Subarray Sum bo sebelisa Karohano le ho Hlōla Polelo ea Bothata Bothateng ba "Maximum Subarray Sum e sebelisang Divide le Conquer" re fane ka lethathamo la linomoro tse ntle le tse mpe. Ngola lenaneo le tla fumana kakaretso e kholo ka ho fetisisa ea karoloana e ikhethileng. Fomate ea ho Kena Mohala oa pele o nang le palo e kholo ea N. Mohala oa bobeli o nang le pokello ea ...

Bala haholoanyane

Potso ea 69. Lokisetsa ho fuoa linomoro ho theha palo e kholo ka ho fetisisa ea II Polelo ea Bothata Bothateng ba "hlophisa linomoro tse fuoeng ho etsa palo e kholo ka ho fetisisa ea bobeli", re fane ka lenane la linomoro tse nepahetseng. Li hlophise ka tsela ea hore tlhophiso e tla theha boleng bo boholo ka ho fetisisa. Fomate ea ho kenya: Mohala oa pele le o le mong feela o nang le n Mohala oa bobeli o nang le ...

Bala haholoanyane

Potso ea 70. Subarray e kholo ka ho fetisisa e nang le palo e lekanang ea 0 le 1 Polelo ea Bothata Bothateng ba "kholo ka ho fetisisa e nang le palo e lekanang ea 0 le 1", re fane ka lethathamo [] le nang le 0 le 1 feela. index ea qetellong ea karoloana e kholo ka ho fetisisa. ...

Bala haholoanyane

Potso ea 71. 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 72. Palo ea likaroloana tse nyane ka lehlakoreng le letona Polelo ea Bothata Bothateng ba "Palo ea Lintho tse Nyane ka lehlakoreng le Letona", re fane ka letoto []. Fumana palo ea likaroloana tse nyane tse ka lehlakoreng le letona la lehlakoreng le leng le le leng. Fomate ea Input Mohala oa pele le o le mong feela o nang le palo e kholo ea N. Mohala oa bobeli o nang le linomoro tse arohaneng tsa sebaka sa N. Khumo ...

Bala haholoanyane

Potso ea 73. Lintho li hlaha ka makhetlo a fetang N / K ho Array Polelo ea Bothata Bothateng ba "Elements bo hlaha ho feta makhetlo a N / K ho Array" re fane ka bongata bo boholo ba n. Fumana lintlha tse hlahang makhetlo a fetang n / k. Moo k ke boleng ba ho kenya. Sebopeho sa Input Mohala oa pele mme e le 'ngoe feela o nang le linomoro tse peli tsa N le ...

Bala haholoanyane

Potso ea 74. 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 75. Lintlha tse 'ne tseo re lokelang ho li fuoa Polelo ea Bothata Linthong tse 'ne tse akaretsang bothata bo fanoeng, re fane ka sehlopha se nang le likarolo tsa N tse ka bang ntle kapa tse mpe. Fumana sete ea likarolo tse 'ne tseo kakaretso ea tsona e lekanang le boleng bo fuoeng k. Fomate ea Input Mohala oa pele o nang le palo e kholo ea N. Mohala oa bobeli o nang le tatellano ...

Bala haholoanyane

Potso ea 76. 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 77. 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 78. Maximum Element in the Array e ntseng e eketseha ebe ea fokotseha Polelo ea Bothata Lethathamong le fanoeng le nang le likaroloana tsa n. Lintho li bolokoa ka tsela ea hore likarolo tsa pele tsa k li hlophisehe ka mokhoa o ntseng o eketseha ebe likarolo tsa nk li fokotseha ho tloha moo, re hloka ho fumana palo e phahameng ea lenane. Mohlala a) Lethathamo la ho kenya: [15, 25, ...

Bala haholoanyane

Potso ea 79. 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 80. 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 81. 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 82. 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 83. 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 84. Hlophisa 0s 1s and 2s in the Array Polelo ea Bothata e fuoe lethathamo le nang le likarolo tsa N moo likarolo tsa sehlopha e leng 0,1 kapa 2. Hlopha kapa arola 0s 1s le 2s ka tatellano. Hlophisa li zero tsohle halofong ea pele, kaofela li le halofong ea bobeli ebe kaofela li le halofo ea boraro. Keletso ea mohlala 22 ...

Bala haholoanyane

Potso ea 85. 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 86. 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 87. 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 88. 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 89. Katiso ya tse fetileng le tse latelang Tlhaloso ea Bothata Ho Atisoa ha Pele le e latelang: Ka har'a sehlopha se fanoeng, nka sebaka sa ntho e ngoe le e ngoe ka sehlahisoa sa likarolo tse latelang le tse fetileng ho eona. Mme bakeng sa elemente ea pele (a [0]) re hloka ho e nkela sebaka ka sehlahisoa sa se latelang le sona, hobane ntlha ea ho qetela (a [n-1]) re hloka ho e nkela sebaka ...

Bala haholoanyane

Potso ea 90. 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 91. 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 92. Hatisa Lintho Tsohle Tse Khethollang tsa Lenaneo Polelo ea Bothata Re na le lethathamo la linomoro tsa N tse ka bang ntle kapa tse fosahetseng. Re tlameha ho hatisa likarolo tsohle tse fapaneng tsa sehlopha. Ka mantsoe a mang, re ka re haeba palo e hlaha nako e fetang e le 'ngoe joale re hatisa palo eo hang feela. Keletso ea Mohlala ...

Bala haholoanyane

Potso ea 93. Boholo ba Element Polelo ea Bothata Ha re fuoa sehlopha se hlophisitsoeng, re hloka ho fumana likarolo tse ngata ho tsoa ho tse hlophisitsoeng. Boholo ba elemente: Nomoro e etsa palo e fetang halofo ea boholo ba sehlopha. Mona re fane ka nomoro x re tlameha ho e sheba hore na ke bongata_bo bongata kapa che. Mohlala Input 5 2 ...

Bala haholoanyane

Potso ea 94. 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 Adobe String

Potso ea 95. Tharollo ea Leetcode e Tloaelehileng e telele ka ho fetisisa Polelo ea Bothata The Longest Common Prefix LeetCode Solution - "Longest Common Prefix" e bolela hore ho fanoe ka mefuta e mengata ea likhoele. Re hloka ho fumana sehlongwapele se selelele ka ho fetisisa hara dikgwele tsena. Haeba ho se na sehlongoapele, khutlisetsa khoele e se nang letho. Mohlala: Kenyelletso: strs = ["palesa",,"phalla","sefofane"] Sephetho: "fl" Tlhaloso: "fl" ke e telele ka ho fetisisa ...

Bala haholoanyane

Potso ea 96. Masakaneng a Sebetsang Tharollo ea Leetcode Polelo ea Bothata Tharollo ea LeetCode e Sebetsang - "Masakaneng a Tšepahalang" e re o fuoa khoele e nang le litlhaku feela '(', ')', '{', '}', '[' le ']'. Re hloka ho fumana hore na khoele ea ho kenya ke khoele e nepahetseng kapa che. Khoele ho thoe ke khoele e sebetsang haeba masakaneng a bulehileng a tlameha ho koaloa ...

Bala haholoanyane

Potso ea 97. 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 98. Bala 'me u re Tharollo ea Leetcode Phatlalatso ea Bothata The Count and Say LeetCode Solution - "Bala 'me u bue" e u kopa hore u fumane nako ea nth ea tatellano ea ho bala le ho re. Tatellano ea ho bala le ho re ke tatelano ea likhoele tsa linomoro tse hlalosoang ka mokhoa o iphetang: countAndSay(1) = "1" countAndSay(n) ke tsela eo u ka "buang" khoele ea linomoro ho tloha countAndSay(n-1), e ntan'o fetoloa ...

Bala haholoanyane

Potso ea 99. Tlosa Masakaneng a Fosahetseng Tharollo ea Leetcode Polelo ea Bothata Tlosa Masakaneng a Fosahetseng Leetcode Tharollo - e bolela hore o fuoa likhoele tse nang le masaka le litlhaku tse nyane. Re hloka ho tlosa bonyane palo ea mashaka a sa sebetseng ho etsa hore mohala o sebetse. Re hloka ho khutlisa liphetho tsohle tse ka bang teng ka tatellano efe kapa efe. Khoele ke...

Bala haholoanyane

Potso ea 100. Tharollo ea Isomorphic Strings Leetcode Polelo ea Bothata bothateng bona, re fuoa likhoele tse peli, a le b. Morero oa rona ke ho tseba hore na likhoele tse peli ke isomorphic kapa che. Likhoele tse peli li bitsoa isomorphic haeba feela ha litlhaku tse khoeleng ea pele li ka nkeloa sebaka ke sebapali sefe kapa sefe (ho kenyelletsa le sona).

Bala haholoanyane

Potso ea 101. Na Tharollo ea Leetcode ea Kamorao Polelo ea Bothata Bothateng bona, re fuoa likhoele tse peli tse fapaneng. Morero ke ho fumana hore na khoele ea pele ke tatellano ea ea bobeli. Mehlala khoele ea pele = "abc" khoele ea bobeli = "mnagbcd" nete ea pele ea khoele = "burger" ea bobeli khoele = "li-dominos" Mokhoa oa bohata (Ho pheta-pheta) Hona ho bonolo ...

Bala haholoanyane

Potso ea 102. Ho rarolla tharollo ea Leetcode ea tlase Bothata ho Lower Case Leetcode Solution e re fa khoele mme e re kopa ho fetolela litlhaku tsohle tse kaholimo ho li-alphabets. Re kopuoa ho fetolela litlhaku tsohle tse kaholimo kapa tse nyane ka litlhaku tse nyane. Kahoo, bothata bo bonahala bo le bonolo empa pele ho ...

Bala haholoanyane

Potso ea 103. Fumana Phapang ea Leetcode Tharollo Bothateng bona, re fuoa likhoele tse peli. Khoele ea bobeli e hlahisoa ka ho phunya litlhaku tsa khoele ea pele ka mokhoa o sa reroang ebe o eketsa sebapali se eketsehileng maemong afe kapa afe. Re hloka ho khutlisa sebopeho se seng se ekelitsoeng khoeleng ea bobeli. Litlhaku li tla lula li ...

Bala haholoanyane

Potso ea 104. Roman to Tharollo ea Leetcode e kholo Bothateng "Roman to Integer", re fuoa khoele e emelang linomoro tse ling tse nepahetseng ka sebopeho sa eona sa palo ea Seroma. Linomoro tsa Roma li emeloa ke litlhaku tse 7 tse ka fetoleloang ho li-integer ho sebelisa tafole e latelang: Tlhokomeliso: Boleng ba palo e felletseng ea palo e fanoeng ea roma e ke ke ea feta kapa ...

Bala haholoanyane

Potso ea 105. Kakaretso ea Tharollo ea Leetcode ea Roma Bothateng bona re fuoa palo e felletseng mme re kopuoa ho fetolela lipalo tsa roman. Kahoo bothata ka kakaretso bo bitsoa "Integer to Roman" mme ena ke Integer to Roman Leetcode Solution. Haeba motho a sa tsebe ka lipalo tsa Roma. Mehleng ea khale, batho ba ne ba sa ...

Bala haholoanyane

Potso ea 106. 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 107. Fumana Index ea Bracket e Koalang bakeng sa Bracket e Bulehileng e Bontšitsoeng ka Tlhaloso Polelo ea Bothata e fuoe khoele ea bolelele / boholo n le boleng bo boholo bo emelang index ea bracket ea ho bula. Fumana lenane la ho koala bracket bakeng sa bracket e bulehileng e fanoeng ka polelo. Mohlala s = "[ABC [23]] [89]" index = 0 8 s = "[C- [D]]" index = 3 5 s ...

Bala haholoanyane

Potso ea 108. Tlosa masakaneng khoele ea algebraic e nang le li-opareitara + le - Polelo ea Bothata U fuoa khoele ea boholo ba n e emelang polelo ea lipalo le masakana. Bothata "Tlosa masakaneng ho khoele ea algebraic e nang le + le - lisebelisoa" e re kopa ho theha mosebetsi o ka nolofatsang polelo e fanoeng. Mohlala s = "a- (b + c)" abc s = a- (bc- (d + e)) - f a-b + c + d + ef ...

Bala haholoanyane

Potso ea 109. Fetolela mantsoe ka khoele Polelo ea Bothata "Reverse mantsoe ka khoele" e re o filoe khoele ea boholo ba n. Hatisa khoele ka tatellano e fapaneng hore lentsoe la ho qetela e be la pele, la bobeli la ho qetela e be la bobeli, joalo-joalo. Mona re bua ka polelo e nang le mantsoe ho fapana ...

Bala haholoanyane

Potso ea 110. Hlahloba Litsela Mathateng a Decode Ways re fane ka khoele e se nang letho e nang le linomoro feela, fumana palo ea litsela tsa ho e khetholla u sebelisa 'mapa o latelang:' A '-> 1' B '-> 2 ...' Z '-> 26 Mohlala S = "123" Palo ea litsela tsa ho khetholla khoele ena ke 3 Haeba re ...

Bala haholoanyane

Potso ea 111. Tumello e latelang Bothateng bo latelang ba tumello re fane ka lentsoe, fumana lengolo le phahameng ho feta la eona. Mohlala oa ho kenya: str = "tutorialcup" tlhahiso: tlhahiso ea tutorialpcu: str = "nmhdgfecba" tlhahiso: nmheabcdfg input: str = "algorithms" tlhahiso: tlhahiso ea algorithsm: str = "spoonfeed" tlhahiso: Tumello e latelang ...

Bala haholoanyane

Potso ea 112. 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 113. 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 114. Masakaneng a Sebetsang Tharollo ea LeetCode Ho Masakaneng a Nepahetseng bothata ba LeetCode re fane ka khoele e nang le litlhaku feela '(', ')', '{', '}', '[' le ']', ho lekola hore na khoele ea ho kenya e nepahetse. Mona re tla u fa Tharollo e nepahetseng ea Masakaneng a LeetCode ho uena. Khoele e kenang e sebetsa haeba: Masakaneng a bulehileng a tlameha ho koaloa ...

Bala haholoanyane

Potso ea 115. 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 116. Hlopha thapo ho ea ka khoele e 'ngoe Polelo ea Bothata E fuoe likhoele tse peli tsa ho kenya, mohlala le khoele. Re hloka ho hlopha khoele ho latela tatellano e hlalositsoeng ke paterone. Mohala oa paterone ha o na likopi mme o na le litlhaku tsohle tsa khoele. Mofuta oa Keketso Mohala oa pele o nang le khoele eo re e hlokang ...

Bala haholoanyane

Potso ea 117. Lekola hore na khoele e ke ke ea hlola e ba le letho ka ho hlakola mohala o fanoeng Polelo ea Bothata Bothateng ba "Hlahloba hore na khoele e ka ba lefeela ka ho pheta-pheta ho hlakola mohala o fanoeng" re file likhoele tse peli "s" le "t". Re tlameha ho lekola hore na likhoele tsa "input" tse fanoeng li ka hlakoloa ka botlalo ka ho hlakola khoele e fanoeng ea "t" khafetsa. Tlhokomeliso: Ha ho fanoa ka khoele e nyane e lokela ho ...

Bala haholoanyane

Potso ea 118. Palindrome e nyane ka ho fetesisa kamora Phetolo Polelo ea Bothata Bothateng ba "Palindrome e nyane ka ho fetesisa kamora ho nkeloa sebaka" re file khoele ea ho kenya e na le litlhaku tse tlase tsa litlhaku le matheba (.). Re hloka ho khutlisa matheba ohle ka litlhaku tse ling hore mohala o hlahang o fetohe palindrome. Palindrome e lokela ho ba nyane haholo ka mokhoa oa lexicograph. Keletso ...

Bala haholoanyane

Potso ea 119. Lekola hore na String e latela tatellano ea batho bao ho buuoang ka bona kapa che Polelo ea Bothata Bothateng ba "Hlahloba hore na Khoele e latela tatellano ea Litlhaku ka Mohlala kapa che" re tlameha ho lekola hore na litlhaku tse teng mohalong o kentsoeng li latela tatellano e ts'oanang le e khethiloeng ke litlhaku tse teng ka har'a mofuta o fanoeng ebe o hatisa "Ee" e ngoe printa "Che". Mofuta oa Keketso ...

Bala haholoanyane

Potso ea 120. Arola likhoele tse 'ne tse fapaneng Polelo ea Bothata Bothateng ba "Split Four Distinct Strings" re tlameha ho lekola hore na khoele e kentsoeng ea ho kenya e ka arohana ka likhoele tse 4 hoo mohala o mong le o mong o se nang letho o fapaneng le o mong. Fomate ea Input Mofuta oa pele le o le mong feela o nang le khoele "s". Sebopeho sa Khatiso Hatisa "E" haeba ...

Bala haholoanyane

Potso ea 121. Reverse khoele Ntle Mofuta oa Nakoana Polelo ea Bothata Bothateng ba "Reverse String Ntle le Phapang ea Nakoana" re fane ka khoele "s". Ngola lenaneo ho khutlisa thapo ena ntle le ho sebelisa se fapaneng kapa sebaka. Fomete ea Input Mohala oa pele o nang le khoele e fuoeng "s". Sebopeho sa Phatlalatso Hatisa khoele e ka morao ho ...

Bala haholoanyane

Potso ea 122. Bala lipara tse peli hole joalo ka li-Alphabets tsa Senyesemane Polelo ea Bothata Bothateng ba "Bala lipara tse peli hole joalo ka li-Alphabets tsa Senyesemane" re fane ka khoele "s". Ngola lenaneo le tla hatisa palo ea lipara tse likarolo tsa tsona li leng hole le li-alphabets tsa Senyesemane. Fomate ea ho Kena Mohala oa pele o nang le se fanoeng ...

Bala haholoanyane

Potso ea 123. Fetolela khoele e pheta-phetang mohala o bolelele K Polelo ea Bothata Bothateng ba "Fetolela khoele e pheta-phetang karolo e telele ea bolelele K" re fane ka khoele "s" le "int" e kholo. Ngola lenaneo ho lekola hore na ho ka khonahala ho e fetolela khoeleng e pheta-phetoang ea mohala o nang le ...

Bala haholoanyane

Potso ea 124. Sebopeho sa Nth ho String ea Decimal ea Concatenated Polelo ea Bothata Bothateng ba "Nth Character in Concatenated Decimal String" re fane ka boleng bo felletseng ba "n". Ngola lenaneo ho fumana sebapali sa Nth khoeleng eo ho eona liqetoana tsohle li tiisitsoeng. Fomate ea ho kenya: Mohala oa pele le o le mong feela o nang le boleng bo boholo ba n. Sebopeho sa Khumo ...

Bala haholoanyane

Potso ea 125. Bapisa lipalo tse peli tsa Version Polelo ea Bothata e fuoe likhoele tse peli tsa ho kenya, tse ka sebopeho sa linomoro tsa mofuta. Nomoro ea mofuta e shebahala joalo ka abcd moo a, b, c, d e leng li-integer. Ka hona, nomoro ea phetolelo ke khoele eo linomoro li arotsoeng ka matheba ho eona. Re hloka ho bapisa likhoele tse peli (linomoro tsa mofuta) le ...

Bala haholoanyane

Potso ea 126. Nako e telele ka ho fetesisa e nang le tumello Polelo ea Bothata Bothateng ba "Nako e telele ka ho fetesisa e nang le tumello" re fane ka likhoele tse peli "s" le "t". Fumana khoele e telele ka ho fetisisa eo tumello ea eona e leng tatellano ea likhoele tse peli tse fanoeng. Khumo e telele haholo e tlameha ho hlophisoa. Fomate ea ho kenya Mohala oa pele o nang le khoele “s”. Mohala oa bobeli o nang le ...

Bala haholoanyane

Potso ea 127. Palindrome e telele ka ho fetesisa e ka etsoa ka ho tlosa kapa ho hlophisa bocha litlhaku Polelo ea Bothata Ho "Palindrome e telele ka ho fetesisa e ka etsoa ka ho tlosa kapa ho hlophisa bocha litlhaku" re fane ka khoele "s". Fumana palindrome e telele ka ho fetesisa e ka hahoang ka ho tlosa kapa ho hlophisa bocha litlhaku tse ling kapa mohlomong litlhaku tsa zero ho khoele. Ho kanna ha ba le tharollo tse ngata tse ka khonehang, o ka ...

Bala haholoanyane

Potso ea 128. 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 129. 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 130. Kakaretso ea linomoro ho String Potsong ena, re tla ithuta ho bala Kakaretso ea linomoro ka Setatemente sa Bothata ba Khoele Ho "Bala Kakaretso ea Linomoro Tsohle Tse Teng ka Khoele" bothata re fane ka khoele "s". Khoele ena e na le linomoro tsa alphanumeric le litlhaku tse nyane tsa Senyesemane. Ngola lenaneo le...

Bala haholoanyane

Potso ea 131. Nyeoe e Tlaase Ho ea ho Nyeoe e Holimo Polelo ea Bothata Bothateng ba "Lower Case To Up Up Case", re file khoele "s" e nang le litlhaku tse nyane feela. Ngola lenaneo le tla hatisa khoele e tšoanang empa le litlhaku tse kholo. Fomete ea Input Mohala oa pele le o le mong feela o nang le khoele “s”. Sebopeho sa Khetho The ...

Bala haholoanyane

Potso ea 132. 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 133. Fetola bong ba khoele e fanoeng Polelo ea Bothata Bothateng ba "Fetola Bong ba khoele e fuoeng" re fane ka khoele "s". Ngola lenaneo le tla fetola mantsoe ohle a amanang le bong ka hara khoele ea ho kenya. Mokgwa wa ho Input Mola wa pele mme e le nngwe feela o nang le polelo kapa kgwele e nang le dibaka “s”. Sebopeho sa Khatiso ...

Bala haholoanyane

Potso ea 134. Ho pheta-pheta ha nako ea bolelele ba bobeli kapa ho feta Polelo ea Bothata Bothateng ba "Ho pheta-pheta ha bolelele ba bobeli kapa ho feta" re file khoele "s". Fumana hore na ho na le tatellano ea bolelele ba tse ling tse peli. Likarolo tse nyane ha lia lokela ho ba le sebopeho se ts'oanang maemong a le mang. Fomate ea ho Kena Mohala oa pele ebile e le 'ngoe feela o nang le ...

Bala haholoanyane

Potso ea 135. Algorithm ea Marang-rang bakeng sa ho Lekola Palindrome ka Molapo Polelo ea Bothata Bothateng ba "Algorithm ea Inthaneteng bakeng sa ho Lekola Palindrome ka Molapo", re fane ka letoto la litlhaku (barekisi ba amoheloa ka bonngoe). Ngola lenaneo le tla hatisa 'e' nako le nako haeba litlhaku tse amohetsoeng ho fihlela joale li theha palindrome. Fomate ea ho Kena ea pele le 'ngoe feela ...

Bala haholoanyane

Potso ea 136. Lekola hore na Likhoele tse peli tse fuoeng ke Isomorphic e mong ho e mong Polelo ea Bothata Bothateng ba "Hlahloba hore na Likhoele tse peli tse fuoeng ke tse ling" ke mathata ao re a fileng likhoele tse peli s1 le s2. Ngola lenaneo le bolelang hore na likhoele tse fanoeng ke isomorphic kapa che. Tlhokomeliso: Ho thoe likhoele tse peli ke isomorphic haeba ho na le e le ngoe ho ...

Bala haholoanyane

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

Potso ea 138. Fesetere e nyane ka ho fetisisa thapong e nang le litlhaku tsohle tsa khoele e 'ngoe Fumana khoele e nyenyane ka ho fetisisa khoeleng e fanoeng e nang le litlhaku tsohle tsa lentsoe kapa Fumana fensetere e nyenyane ka ho fetisisa khoeleng e nang le litlhaku tsohle tsa khoele e 'ngoe Ho fanoe ka likhoele tse peli s le t, ngola mosebetsi o tla fumana fensetere e nyenyane ka ho fetisisa. tla...

Bala haholoanyane

Potso ea 139. Lokisetsa ho fuoa linomoro ho theha palo e kholo ka ho fetisisa ea II Polelo ea Bothata Bothateng ba "hlophisa linomoro tse fuoeng ho etsa palo e kholo ka ho fetisisa ea bobeli", re fane ka lenane la linomoro tse nepahetseng. Li hlophise ka tsela ea hore tlhophiso e tla theha boleng bo boholo ka ho fetisisa. Fomate ea ho kenya: Mohala oa pele le o le mong feela o nang le n Mohala oa bobeli o nang le ...

Bala haholoanyane

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

Lipotso tsa Sefate sa Adobe

Potso ea 141. Ho hlahisa lintlha tse latelang tse nepahetseng ho Tharollo e 'ngoe le e 'ngoe ea Leetcode ea Node Polelo ea Bothata The Populating Next Right Pointers ho Node e 'ngoe le e 'ngoe ea LeetCode Tharollo - "Populating Next Right Pointers ho Node e 'ngoe le e' ngoe" e bolela hore ho fanoe ka motso oa sefate se phethahetseng sa binary 'me re hloka ho hlahisa ntlha e' ngoe le e 'ngoe e latelang ea node ho ea sebakeng sa eona se latelang se nepahetseng. Haeba ha ho na se latelang ...

Bala haholoanyane

Potso ea 142. Hlaphoheloa Binary Search Tree Leetcode Tharollo Polelo ea Bothata The Recover Binary Search Tree LeetCode Tharollo - "Khutlisa Binary Search Tree" e bolela hore ho fanoe ka motso oa sefate sa lipatlisiso sa binary, moo litekanyetso tsa li-node tse peli hantle li fetotsoeng ka phoso. Re hloka ho khutlisa sefate ntle le ho fetola sebopeho sa sona. Mohlala: Kenyo: motso = [1,3,null,null,2] Output: [3,1,null,null,2] ...

Bala haholoanyane

Potso ea 143. Symmetric Tree Leetcode Tharollo Tlhaloso ea Bothata The Symmetric Tree LeetCode Tharollo - "Symmetric Tree" e bolela hore ho fanoe ka motso oa sefate sa binary 'me re lokela ho hlahloba hore na sefate sa binary se fanoeng ke seipone sa sona (symmetric ho pota setsi sa sona) kapa che? Haeba E, re hloka ho khutlisa 'nete ho seng joalo, leshano. Mohlala: ...

Bala haholoanyane

Potso ea 144. Kakaretso ea Tharollo ea Leetcode ea Left code Bothateng bona, re tlameha ho fumana kakaretso ea makhasi ohle a setseng sefateng sa binary. Lekhasi le bitsoang "Left Leaf" haeba e le ngoana ea leqele oa noute efe kapa efe sefateng. Mohlala 2 / \ 4 7 / \ 9 4 Sum ke 13 ...

Bala haholoanyane

Potso ea 145. Lekola hore na sehlopha se fanoeng se ka emela Preorder Traversal of Binary Search Tree Bothata "Hlahloba hore na sehlopha se fanoeng se ka emela Preorder Traversal of Binary Search Tree" se re o fuoe tatellano ea ho eta esale pele. Joale nahana ka tatellano ena 'me u fumane hore na tatellano ena e ka emela sefate sa patlo ea binary kapa che? Ho rarahana ha nako e lebelletsoeng bakeng sa tharollo ke ...

Bala haholoanyane

Potso ea 146. Hatisa Pono e Nepahetseng ea Sefate sa Binary Polelo ea Bothata Bothata "Hatisa Pono e Nepahetseng ea Sefate sa Binary" e re o fuoe sefate sa binary. Joale o hloka ho fumana pono e nepahetseng ea sefate sena. Mona, pono e nepahetseng ea sefate sa binary e bolela ho hatisa tatellano ha sefate se shebahala ha se shebahala ho tloha ...

Bala haholoanyane

Potso ea 147. Mokhoa o Iterative ho fumana Bophahamo ba Binary Tree Polelo ea Bothata Bothata "Mokhoa oa ho sebelisa ho fumana Bophahamo ba Sefate sa Binary" e re o fuoe sefate sa binary, fumana bophahamo ba sefate u sebelisa mokhoa oa iterative. Mehlala Keketso 3 Keletso 4 Algorithm ea Mokhoa o Ikhethileng oa ho fumana Bophahamo ba Binary Tree Bophahamo ba sefate ...

Bala haholoanyane

Potso ea 148. Hlahloba hore na litekanyetso tsohle tsa Binary Tree li na le anagrams kapa che Polelo ea Bothata Bothata "Hlahloba hore na maemo ohle a Binary Tree ke anagrams kapa che" e re o fuoe Lifate tse peli tsa Binary, hlahloba hore na maemo ohle a lifate tse peli ke anagrams kapa che. Mehlala Input True Input Algorithm ea Bohata ho Lekola hore na maemo ohle a mabeli ...

Bala haholoanyane

Potso ea 149. Iterative Postorder Traversal U sebelisa mekotla e 'meli Polelo ea Bothata Bothata "Ho Istative Postorder Traversal Using Two Stacks" ho bolela hore o fuoa sefate sa binary se nang le li-node. Ngola lenaneo bakeng sa ho pheta-pheta molaetsa oa poso o sebelisang mekotla e 'meli. Kakanyo ea Mohlala 4 5 2 6 7 3 1 Ho kenya 4 2 3 1 Algorithm Etsa ...

Bala haholoanyane

Potso ea 150. Mokhoa oa ho sebelisa mokhoa oa ho fumana baholo-holo ba sefate sa binary se fanoeng Polelo ea Bothata "Mokhoa oa ho khetha ho fumana baholo-holo ba sefate se fanoeng ka binary" bothata bo re o fuoa sefate sa binary le palo e emelang senotlolo. Etsa mosebetsi oa ho hatisa baholo-holo bohle ba senotlolo se fanoeng u sebelisa iteration. Konopo ya ho kenya Input = 6 5 2 1 Tlhaloso: ...

Bala haholoanyane

Potso ea 151. Lenaneo la ho lekola hore na sefate sa binary ke BST kapa che Polelo ea Bothata "Lenaneo la ho lekola hore na sefate sa binary ke BST kapa che" le re o fuoe sefate sa binary mme o hloka ho lekola hore na sefate sa binary se khotsofatsa litšobotsi tsa sefate sa patlo sa binary. Kahoo, sefate sa binary se na le thepa e latelang: Tlatsetso e ka letsohong le letšehali ...

Bala haholoanyane

Potso ea 152. Sefate sa Binary ho Phetoho ea Lifate tsa Binary Sefateng sa binary ho na le bothata ba phetoho ea patlo ea patlo ea patlo, re file sefate sa binary ho se fetolela ho Binary Search Tree ntle le ho fetola sebopeho sa sefate. Peakanyo ea tlhahiso ea tlhahiso ea mohlala ea mohlala: 13 8 6 47 25 51 Algorithm Ha rea ​​tlameha ho fetola sebopeho sa ...

Bala haholoanyane

Potso ea 153. E hlophisitsoe ka tatellano ho ea ho Banced BST Ka tatellano e hlophisitsoeng ho ba le bothata bo leka-lekaneng ba BST, re fane ka tatellano ka tatellano, re aha Balanced Binary Search Tree ho tloha ho arotsoe. Mehlala Input arr [] = {1, 2, 3, 4, 5} Tlhahiso-pele ea tlhahiso: 3 2 1 5 4 Input arr [] = {7, 11, 13, 20, 22, ...

Bala haholoanyane

Potso ea 154. Taelo ea boemo e tsamaeang ka foromo ea moea Bothateng bona re file sefate sa binary, hatisa boemo ba sona ba ho otlolla ka sebopeho sa moea. Mehlala Khumo Keketso 10 30 20 40 50 80 70 60 Mokhoa o se nang thuso bakeng sa tatellano ea maemo o fapakaneng ka foromo ea moea Sepheo ke ho etsa tatellano e tloaelehileng ea taolo o sebelisa ...

Bala haholoanyane

Potso ea 155. Baholo-holo ba Tloaelehileng ka ho Fetisisa Fuoa motso oa sefate sa binary le li-node tse peli n1 le n2, fumana LCA (Lowest Common Ancestor) ea li-node. Mohlala Ke eng baholo-holo ba tloaelehileng (LCA)? Baholo-holo ba node n ke linomoro tse teng tseleng e lipakeng tsa motso le node. Nahana ka sefate sa binary se bontšitsoeng ho ...

Bala haholoanyane

Potso ea 156. 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 157. 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 158. 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 159. Ho Tsamaea ha Sefate (Preorder, Inorder & Postorder) Taba ea mantlha, re hloka ho tseba hore na Traversal in Binary Tree ke eng. Traversal ke mofuta oa mokhoa oo re etelang li-node tsohle hang ka mokhoa o itseng / tatellano. Ha e le hantle ho na le mefuta e 'meli ea ho haola ka Sefateng sa Binary: Bophara-Pele ba Phallo ea Botebo Botebo ba Pele Re se re ntse re tseba ka ...

Bala haholoanyane

Lipotso tsa Adobe Graph

Potso ea 160. Algorithm ea Dijkstra Dijkstra ke tsela e khutšoane ka ho fetisisa ea algorithm. Algorithm ea Dijkstra e sebelisetsoa ho fumana sebaka se sekhuts'oane ho feta sa li-node tsohle ho tloha node ea qalo e fanoeng. Ka mokhoa o utloahalang e theha sefate se sekhutšoanyane sa sefate ho tsoa mohloling o le mong oa mohloli, ka ho lula u eketsa li-node ka meharo joalo ka hore ntlheng e ngoe le e ngoe node e ngoe ho ...

Bala haholoanyane

Lipotso tsa Adobe Stack

Potso ea 161. 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 162. Masakaneng a Sebetsang Tharollo ea Leetcode Polelo ea Bothata Tharollo ea LeetCode e Sebetsang - "Masakaneng a Tšepahalang" e re o fuoa khoele e nang le litlhaku feela '(', ')', '{', '}', '[' le ']'. Re hloka ho fumana hore na khoele ea ho kenya ke khoele e nepahetseng kapa che. Khoele ho thoe ke khoele e sebetsang haeba masakaneng a bulehileng a tlameha ho koaloa ...

Bala haholoanyane

Potso ea 163. Maximum Frequency Stack Leetcode Solution Polelo ea Bothata The Maximum Frequency Stack LeetCode Solution - "Maximum Frequency Stack" e u kopa hore u rale stack ea khafetsa eo ho eona neng kapa neng ha re hlahisa element ho tsoa stack, e tlameha ho khutlisa ntho e fumanehang khafetsa ka har'a stack. Kenya ts'ebetsong sehlopha sa FreqStack: FreqStack () e etsa stack e se nang letho. void push(int val) sututsa ...

Bala haholoanyane

Potso ea 164. Lekola hore na sehlopha se fanoeng se ka emela Preorder Traversal of Binary Search Tree Bothata "Hlahloba hore na sehlopha se fanoeng se ka emela Preorder Traversal of Binary Search Tree" se re o fuoe tatellano ea ho eta esale pele. Joale nahana ka tatellano ena 'me u fumane hore na tatellano ena e ka emela sefate sa patlo ea binary kapa che? Ho rarahana ha nako e lebelletsoeng bakeng sa tharollo ke ...

Bala haholoanyane

Potso ea 165. Fumana Index ea Bracket e Koalang bakeng sa Bracket e Bulehileng e Bontšitsoeng ka Tlhaloso Polelo ea Bothata e fuoe khoele ea bolelele / boholo n le boleng bo boholo bo emelang index ea bracket ea ho bula. Fumana lenane la ho koala bracket bakeng sa bracket e bulehileng e fanoeng ka polelo. Mohlala s = "[ABC [23]] [89]" index = 0 8 s = "[C- [D]]" index = 3 5 s ...

Bala haholoanyane

Potso ea 166. Theha pokello e tšehetsang GetMin () ka nako ea O (1) le O (1) sebaka se eketsehileng Theha pokello e tšehetsang GetMin () ka nako ea O (1) le sebaka se eketsehileng sa O (1). Ka hona sebopeho se ikhethileng sa data se tlameha ho ts'ehetsa ts'ebetso eohle ea `` stack '' joalo ka - void push () int pop () bool isFull () bool isEmpty () ka nako e sa feleng. Kenya ts'ebetso e 'ngoe GetMin () ho khutlisa boleng bo tlase ...

Bala haholoanyane

Potso ea 167. Tlosa masakaneng khoele ea algebraic e nang le li-opareitara + le - Polelo ea Bothata U fuoa khoele ea boholo ba n e emelang polelo ea lipalo le masakana. Bothata "Tlosa masakaneng ho khoele ea algebraic e nang le + le - lisebelisoa" e re kopa ho theha mosebetsi o ka nolofatsang polelo e fanoeng. Mohlala s = "a- (b + c)" abc s = a- (bc- (d + e)) - f a-b + c + d + ef ...

Bala haholoanyane

Potso ea 168. Iterative Postorder Traversal U sebelisa mekotla e 'meli Polelo ea Bothata Bothata "Ho Istative Postorder Traversal Using Two Stacks" ho bolela hore o fuoa sefate sa binary se nang le li-node. Ngola lenaneo bakeng sa ho pheta-pheta molaetsa oa poso o sebelisang mekotla e 'meli. Kakanyo ea Mohlala 4 5 2 6 7 3 1 Ho kenya 4 2 3 1 Algorithm Etsa ...

Bala haholoanyane

Potso ea 169. Mokhoa oa ho sebelisa mokhoa oa ho fumana baholo-holo ba sefate sa binary se fanoeng Polelo ea Bothata "Mokhoa oa ho khetha ho fumana baholo-holo ba sefate se fanoeng ka binary" bothata bo re o fuoa sefate sa binary le palo e emelang senotlolo. Etsa mosebetsi oa ho hatisa baholo-holo bohle ba senotlolo se fanoeng u sebelisa iteration. Konopo ya ho kenya Input = 6 5 2 1 Tlhaloso: ...

Bala haholoanyane

Potso ea 170. Taelo ea boemo e tsamaeang ka foromo ea moea Bothateng bona re file sefate sa binary, hatisa boemo ba sona ba ho otlolla ka sebopeho sa moea. Mehlala Khumo Keketso 10 30 20 40 50 80 70 60 Mokhoa o se nang thuso bakeng sa tatellano ea maemo o fapakaneng ka foromo ea moea Sepheo ke ho etsa tatellano e tloaelehileng ea taolo o sebelisa ...

Bala haholoanyane

Potso ea 171. Mola o sebelisa Stacks Ha re le lethathamong re sebelisa bothata ba mokoallo, re tlameha ho kenya tšebetsong mesebetsi e latelang ea lethathamo re sebelisa lits'ebetso tse tloaelehileng tsa sethala sa data, Enqueue: Eketsa ntlha ho fihlela qetellong ea lethathamo la lethathamo: Tlosa ntho ho tloha qalong ea lethathamo mohlala Input : Enqueue (5) Enqueue (11) Enqueue (39) Dequeue () ...

Bala haholoanyane

Potso ea 172. Tharollo ea LeetCode ea Metsi a ho Tlisa Pula Bothateng ba LeetCode ea Metsi a Trapping Rain Water, re fane ka linomoro tsa N non-negative tse emelang 'mapa oa bophahamo 'me bophara ba bar e' ngoe le e 'ngoe ke 1. Re tlameha ho fumana bongata ba metsi a ka qabelloang mohahong o ka holimo. Mohlala Ha re utloisise hore ka mohlala Bakeng sa ...

Bala haholoanyane

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

Lipotso tsa Adobe Queue

Potso ea 174. Ts'ebetsong ea Deque o sebelisa Lenane la Doubly Linked Polelo ea Bothata Bothata "Ts'ebetsong ea Deque o sebelisa Lethathamo la Doubly Linked" e re o hloka ho kenya tšebetsong mesebetsi e latelang ea Deque kapa Doubly Ended Queue o sebelisa lethathamo le kopantsoeng habeli, insertFront (x): Kenya element x qalong ea Deque insertEnd (x Eketsa element x qetellong ea ...

Bala haholoanyane

Potso ea 175. Mokhoa o Iterative ho fumana Bophahamo ba Binary Tree Polelo ea Bothata Bothata "Mokhoa oa ho sebelisa ho fumana Bophahamo ba Sefate sa Binary" e re o fuoe sefate sa binary, fumana bophahamo ba sefate u sebelisa mokhoa oa iterative. Mehlala Keketso 3 Keletso 4 Algorithm ea Mokhoa o Ikhethileng oa ho fumana Bophahamo ba Binary Tree Bophahamo ba sefate ...

Bala haholoanyane

Potso ea 176. Hlahloba hore na litekanyetso tsohle tsa Binary Tree li na le anagrams kapa che Polelo ea Bothata Bothata "Hlahloba hore na maemo ohle a Binary Tree ke anagrams kapa che" e re o fuoe Lifate tse peli tsa Binary, hlahloba hore na maemo ohle a lifate tse peli ke anagrams kapa che. Mehlala Input True Input Algorithm ea Bohata ho Lekola hore na maemo ohle a mabeli ...

Bala haholoanyane

Potso ea 177. Mola o sebelisa Stacks Ha re le lethathamong re sebelisa bothata ba mokoallo, re tlameha ho kenya tšebetsong mesebetsi e latelang ea lethathamo re sebelisa lits'ebetso tse tloaelehileng tsa sethala sa data, Enqueue: Eketsa ntlha ho fihlela qetellong ea lethathamo la lethathamo: Tlosa ntho ho tloha qalong ea lethathamo mohlala Input : Enqueue (5) Enqueue (11) Enqueue (39) Dequeue () ...

Bala haholoanyane

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

Lipotso tsa Adobe Matrix

Potso ea 179. Beha Tharollo ea Leetcode ea Matrix Zeroes Polelo ea Bothata The Set Matrix Zeroes LeetCode Solution – “Set Matrix Zeroes” e bolela hore u filoe mxn integer matrix. ho ea 0. U tlameha ho e etsa ka ...

Bala haholoanyane

Potso ea 180. Tharollo ea Matrix Diagonal Sum Leetcode Polelo ea Bothata Bothateng ba Matrix Diagonal Sum ho fanoa ka lipalo tse sekwere tsa linomoro. Re tlameha ho bala kakaretso ea likarolo tsohle tse teng litsing tsa eona tse fapaneng, ke hore, likarolo tse ho diagonal tsa mantlha hammoho le tse mahlakore a mabeli tse fapaneng. Karolo ka 'ngoe e lokela ho baloa hang feela. Mohlala mat = [[1,2,3], [4,5,6], ...

Bala haholoanyane

Potso ea 181. Nako e nyane e hlokahalang ho bola lilamunu tsohle Polelo ea Bothata Bothata "Nako e nyane e hlokahalang ho bola lilamunu tsohle" e re o fuoe sehlopha sa 2D, sele e ngoe le e ngoe e na le e 'ngoe ea litekanyetso tse tharo tse ka bang 0, 1 kapa 2. 0 e bolela sele e se nang letho. 1 e bolela lamunu e ncha. 2 e bolela lamunu e bolileng. Haeba se bolileng ...

Bala haholoanyane

Potso ea 182. Boholo ba Square Bothateng bo boholo ba lisekoere re fane ka matrix a 2D a tlatsitsoeng ka 0 le 1, fumana sekoere se seholo se nang le 1 feela, 'me u khutlise sebaka sa eona. Keletso ea mohlala: 1 0 1 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 1 0 XNUMX ...

Bala haholoanyane

Adobe Lipotso tse ling

Potso ea 183. Partition Labels LeetCode Tharollo Phapang ea Bothata Labels LeetCode Tharollo - U fuoa khoele s. Re batla ho arola khoele ka likarolo tse ngata kamoo ho ka khonehang e le hore tlhaku ka 'ngoe e hlahe boholo ba karolo e le' ngoe. Hlokomela hore karohano e etsoa e le hore kamora ho kopanya likarolo tsohle ka tatellano, ...

Bala haholoanyane

Potso ea 184. Khokahano ea Tharollo ea Array LeetCode Polelo ea Bothata : Concatenation of Array LeetCode Solution - Ho fanoe ka palo e feletseng ea bolelele ba n, u batla ho etsa li-ans tsa bolelele ba 2n moo ans[i] == nums[i] le ans[i + n] == nums[ i] bakeng sa 0 <= ke <n (0-indexed). Haholo-holo, ans ke ho kopanngoa ha lipalo tse peli. Khutlisetsa sehlopha sa ans. Mohlala : Mohlala 1 Kenyeletso: nums = [1,2,1] Output: [1,2,1,1,2,1] Tlhaloso: The array ...

Bala haholoanyane

Potso ea 185. 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 186. 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 187. Clone Kerafo LeetCode Tharollo Tlhaloso ea Bothata Clone Graph LeetCode Tharollo - Re fuoa tšupiso ea node ka har'a graph e hokahantsoeng e sa lebelloang 'me re botsoa hore re khutlisetse kopi e tebileng ea graph. Kopi e tebileng ha e le hantle ke ntho eo ho seng node e teng kopi e tebileng e lokelang ho ba le tšupiso ...

Bala haholoanyane

Potso ea 188. Kth Element e Nyenyane ka ho Fetisisa Tharollo ea LeetCode ea Matrix Polelo ea Bothata Kth Ntho e Nyenyane ka ho Fetisisa ka Tharollo ea LeetCode ea Matrix e Hlophisitsoeng - Re fuoa matrix ea boholo n moo mela e 'ngoe le e 'ngoe e hlophisitsoeng ka tatellano e nyolohang. Re kopuoa ho khutlisetsa kth ntho e nyane ka ho fetesisa ka har'a matrix. Hlokomela hore ke kth...

Bala haholoanyane

Potso ea 189. Theha Binary Tree ho tloha ho Preorder le Postorder Traversal LeetCode Solution Setatamente sa Bothata Theha Sefate sa Binary ho tloha ho Preorder le Postorder Traversal LeetCode Solution - Ho fanoe ka lihlopha tse peli tse feletseng, taelo ea pele le ea poso moo taelo ea pele e leng mokhoa oa ho pota-pota oa sefate sa binary sa boleng bo fapaneng le poso ke tsela ea poso ea sefate se le seng, tsosolosa le ho khutlisetsa binary sefate. Haeba ho na le likarabo tse ngata, u ka khutlisa leha e le efe ea tsona. Kenyelletso: Odara esale pele...

Bala haholoanyane

Potso ea 190. Tlosa Likopi ho tsoa Lethathamong le Hlophisitsoeng II LeetCode Tharollo Phatlalatso ea Bothata Tlosa Likopi Ho tloha Lethathamong le Hlophisitsoeng II Tharollo ea LeetCode - Ho fanoe ka hlooho ea lethathamo le hlophisitsoeng le kopantsoeng, hlakola li-node tsohle tse nang le linomoro tse kopitsoang, u siee linomoro tse fapaneng feela ho tloha lethathamong la pele. Khutlisetsa lenane le hokahaneng le hlophisitsoeng hape. Kenyelletso: hlooho = [1,2,3,3,4,4,5] Sephetho: [1,2,5] Tlhaloso Monahano mona ke ho haola ...

Bala haholoanyane

Potso ea 191. Ka Beha Lipalesa LeetCode Tharollo Phatlalatso ea Bothata e ka Beha Lipalesa Tharollo ea LeetCode - U na le sebaka se selelele sa lipalesa moo ho lenngoeng libaka tse ling, 'me tse ling ha li joalo. Leha ho le joalo, lipalesa ha li khone ho lengoa libakeng tse haufi. Ho fanoe ka palo e felletseng ea bethe ea lipalesa e nang le 0 le 1's, moo 0 e bolelang hore ha e na letho 'me 1 e bolela hore ha e na letho, 'me palo e feletseng n, khutla haeba lipalesa tse ncha li ka lengoa ...

Bala haholoanyane

Potso ea 192. Sebopeho sa Pele se Ikhethang ho Tharollo ea LeetCode ea String Polelo ea Bothata Sebopeho sa Pele se Ikhethileng ka Tharollo ea LeetCode ea String - Ho fanoe ka khoele s, fumana sebopeho sa pele se sa phete-phetoang ho sona 'me u khutlisetse index ea sona. Haeba e le sieo, khutlisetsa -1. Mohlala oa Tlhahlobo ea 1: Input: s = “leetcode” Sephetho: 0 Taba ea Teko ea 2: Kenyeletso: s = “aabb” Sephetho: -1 Tlhaloso ...

Bala haholoanyane

Potso ea 193. 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 194. Tharollo ea Leetcode List Phatlalatso ea Bothata : Lethathamo la Likarolo Tharollo ea Leetcode - Ho fanoe ka sehlooho sa lenane le amanang le boleng ba x, e arole ka tsela e le hore li-node tsohle tse ka tlaase ho x li tle pele ho li-node tse kholo ho feta kapa tse lekanang le x. U lokela ho boloka tatellano ea mantlha ea li-node ho e 'ngoe le e' ngoe ea likarolo tse peli. Mohlala : Mohlala 1 Kenyeletso: hlooho = ...

Bala haholoanyane

Potso ea 195. Lekola Reverse Polish Notation LeetCode Tharollo Phatlalatso ea Bothata Lekola Reverse Polish Notation LeetCode Tharollo - Lekola boleng ba polelo ea lipalo ho Reverse Polish Notation. Basebelisi ba sebetsang ke +, -, *, le /. Operand ka 'ngoe e ka ba palo e felletseng kapa polelo e 'ngoe. Hlokomela hore karohano lipakeng tsa linomoro tse peli e tlameha ho fokotseha ho ea ho zero. E netefalitsoe hore e fanoeng ...

Bala haholoanyane

Potso ea 196. Tharollo e Nyenyane ea Range II Leetcode Polelo ea Bothata : Nyenyane ka ho Fetisisa ea Range II Tharollo ea Leetcode - O fuoa palo e felletseng ea palo le nomoro ea k. Bakeng sa index ka 'ngoe ke moo 0 <= i < nums.length, fetola linomoro[i] hore e be linomoro[i] + k kapa linomoro[i] - k. Maduo a dinomoro ke phapang pakeng tsa palo e kahodimodimo le bonyane ba elemente ka dipalo. Khutlisetsa lintlha tse fokolang tsa lipalo ka mor'a ho fetola litekanyetso ho index ka 'ngoe. ...

Bala haholoanyane

Potso ea 197. 3Sum Haufinyane Tharollo ea LeetCode Polelo ea Bothata 3Sum e Haufi ka ho Fetisisa ea Tharollo ea LeetCode – Ka lebaka la palo e felletseng ea palo ea bolelele ba n le palo e felletseng ea palo, fumana linomoro tse tharo ka lipalo hoo kakaretso e leng haufi haholo le sepheo. Khutlisetsa kakaretso ea linomoro tse tharo. U ka 'na ua nahana hore tlhahiso e' ngoe le e 'ngoe e tla ba le tharollo e le' ngoe hantle. Kenyelletso: linomoro = [-1,2,1,-4], target = 1 Sephetho: ...

Bala haholoanyane

Potso ea 198. 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 199. 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 200. 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 201. 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 202. Zigzag Conversion LeetCode Tharollo Polelo ea Bothata Tharollo ea LeetCode ea Zigzag - Khoele "PAYPALISHIRING" e ngotsoe ka mokhoa oa zigzag holim'a palo e fanoeng ea mela e kang ena: (o ka rata ho hlahisa mokhoa ona ka mokhoa o tsitsitseng bakeng sa ho baleha hamolemo) PAHNAPLSIIGYI ...

Bala haholoanyane

Potso ea 203. Koko Eating Banana LeetCode Solution Polelo ea Bothata Koko Ho ja Banana LeetCode Solution – Koko o rata ho ja libanana. Ho na le liqubu tsa libanana, qubu ea ith e na le liqubu[i] libanana. Balebeli ba tsamaile 'me ba tla khutla ka mor'a lihora tsa h. Koko a ka etsa qeto ea libanana tsa hae-ka hora lebelo la ho ja la k. Hora e 'ngoe le e 'ngoe, o khetha qubu ea libanana ebe o ja k banana qubung eo. Haeba ...

Bala haholoanyane

Potso ea 204. 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 205. Litumello ho Tharollo ea Leetcode ea String Polelo ea Bothata : Permutation in String Leetcode Tharollo - Ho fanoe ka likhoele tse peli s1 le s2, khutlela 'nete haeba s2 e na le tumello ea s1, kapa e seng ea bohata. Ka mantsoe a mang, khutlela 'nete haeba e' ngoe ea litumello tsa s1 e le karoloana ea s2. Mohlala : Mohlala 1 Kenyeletso: s1 = "ab", s2 = "eidbaooo" Sephetho: 'nete Tlhaloso: s2 e na le tumello e le 'ngoe ea s1 ("ba"). ...

Bala haholoanyane

Potso ea 206. Etsa qeto ea hore na Matrix e ka Fumaneha Ka Rotation LeetCode Tharollo Phatlalatso ea Bothata Fumana hore na Matrix e ka Fumaneha Ka Rotation LeetCode Tharollo - Ho fanoe ka tse peli nxn binary matrices mat le target, khutlisetsa 'nete haeba ho khoneha ho etsa hore mat a lekane le target ka ho potoloha mat ka 90-degree increments, kapa bohata ho seng joalo. Kenyelletso ea Mehlala: mat = [[0,1],[1,0]], target = [[1,0],[0,1]] Sephetho: Tlhaloso ea 'nete: Re ka potoloha mat ka likhato tse 90 ho ea ka oache ho etsa hore mat a lekane. ...

Bala haholoanyane

Potso ea 207. Tsela e telele ka ho Fetisisa ea Keketseho ka Tharollo ea LeetCode ea Matrix Polelo ea Bothata Tsela e Eketsehileng ka ho Fetisisa ka Tharollo ea LeetCode ea Matrix - Ho fanoe ka mxn integers matrix, khutlisetsa bolelele ba tsela e telele ka ho fetisisa e ntseng e eketseha ka matrix. Ho tloha seleng e 'ngoe le e' ngoe, u ka tsamaea ka litsela tse 'nè: ho le letšehali, ho le letona, holimo, kapa tlase. O kanna oa se ke oa tsamaea ka nqa e le 'ngoe kapa oa tsamaea ka ntle ho moeli (ke hore, ho pota-pota ha ho lumelloe). Kenyelletso:...

Bala haholoanyane

Potso ea 208. 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 209. Binary Tree Maximum Path Sum LeetCode Tharollo Polelo ea Bothata Binary Tree Maximum Path Sum LeetCode Solution - Tsela e sefateng sa binary ke tatellano ea li-node moo para e 'ngoe le e 'ngoe ea li-node tse haufi ka tatellano e nang le moeli o li kopanyang. Node e ka hlaha feela ka tatellano hang. Hlokomela hore tsela ha e hloke ...

Bala haholoanyane

Potso ea 210. Roboto e Tlantsoeng ka Circle LeetCode Tharollo Polelo ea Bothata Robot e Tlanngoeng ka Circle LeetCode Tharollo - Ka sefofane se sa feleng, roboto qalong e ema ho (0, 0) 'me e shebane le leboea. Hlokomela hore: Leboya ke tsela e ntle ya axis ya y. Tsela e ka boroa ke tsela e mpe ea axis ea y. Tsela e ka bochabela ke tsela e ntle ea x-axis. Tsela ea bophirimela ke ...

Bala haholoanyane

Potso ea 211. Bonyane Knight e Tsamaisa LeetCode Tharollo Polelo ea Bothata Bonyane Knight e Tsamaisa LeetCode Tharollo - Ka har'a chessboard e sa feleng e nang le likhokahano ho tloha ho -infinity ho isa +infinity, u na le knight sekwere [0, 0]. Knight e na le metsamao e 8 eo e ka e etsang, joalo ka ha ho bontšitsoe ka tlase. Mohato o mong le o mong o na le lisekoere tse peli ka lehlakoreng la cardinal, ebe sekwere se le seng ka tsela ea orthogonal. Khutlisetsa bonyane ba nomoro ...

Bala haholoanyane

Potso ea 212. Bonyane Palo ea Lipompo ho Buloa ho Nosetsa Tharollo ea LeetCode ea Serapa Polelo ea Bothata Bonyane Palo ea Lipompo tse ka Buloang ho Nosetsa Serapeng LeetCode Tharollo - Ho na le serapa se nang le lehlakore le le leng holim'a x-axis. Serapa se qala ntlheng ea 0 ebe se fella ntlheng ea n. (ke hore bolelele ba serapa ke n). Ho na le lipompo tsa n + 1 tse fumanehang libakeng tsa [0, 1, ..., n] ho ...

Bala haholoanyane

Potso ea 213. 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 214. 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 215. Snakes and Ladders LeetCode Tharollo Problem Statement Snakes and Ladders LeetCode Solution - U fuoa nxn integer matrix board moo lisele li ngotsoeng ho tloha ho 1 ho ea ho n2 ka mokhoa oa Boustrophedon ho tloha ka tlaase ho le letšehali la boto (ke hore board[n - 1][0]) le litsela tse fapanyetsanang moleng o mong le o mong. U qala ka lisekoere 1 tsa boto. Ketsahalong e 'ngoe le e 'ngoe, ...

Bala haholoanyane

Potso ea 216. Arithmetic Slices II - Subsequence LeetCode Solution Polelo ea Bothata : Arithmetic Slices II - Subsequence LeetCode Solution - Ha u fuoa palo e felletseng ea lipalo, khutlisetsa palo ea lipalo tse latelang tsa lipalo tsa lipalo. Tatellano ea linomoro e bitsoa arithmetic haeba e na le bonyane likarolo tse tharo le haeba phapang pakeng tsa likarolo leha e le life tse peli tse latellanang e tšoana. Bakeng sa ...

Bala haholoanyane

Potso ea 217. Path Sum II Tharollo ea LeetCode Polelo ea Bothata : Path Sum II Tharollo ea LeetCode - Ho fanoe ka motso oa sefate sa binary le palo e feletseng ea targetSum, khutlisetsa litsela tsohle tsa motso ho ea makhasi moo kakaretso ea litekanyetso tsa node tseleng e lekanang le targetSum. Tsela e 'ngoe le e' ngoe e lokela ho khutlisoa e le lethathamo la litekanyetso tsa node, eseng litšupiso tsa node. Tsela ea motso ho ea lekhasi ke tsela e qalang ho tloha ...

Bala haholoanyane

Potso ea 218. 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 219. Scramble String LeetCode Tharollo Tlhaloso ea Bothata Scramble String LeetCode Tharollo - Re ka senya khoele ho fumana khoele t ho sebelisa algorithm e latelang: Haeba bolelele ba khoele ke 1, emisa. Haeba bolelele ba khoele e le> 1, etsa se latelang: Arola khoele ka likhoele tse peli tse se nang letho ...

Bala haholoanyane

Potso ea 220. Kakaretso ea Left Leaves LeetCode Tharollo Polelo ea Bothata: Kakaretso ea Left Leaves Tharollo ea LeetCode - Ho fanoe ka motso oa sefate sa binary, khutlisetsa kakaretso ea makhasi ohle a letšehali. Lekhasi ke node e se nang bana. Lekhasi le letšehali ke lekhasi leo e leng ngoana ea letšehali oa node e 'ngoe. Mohlala & Tlhaloso: Input: root = [3,9,20,null,null,15,7] Output: 24 Tlhaloso: Ho na le ...

Bala haholoanyane

Potso ea 221. 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 222. Permutation Sequence LeetCode Tharollo Polelo ea Bothata Tatelano ea Permutation LeetCode Tharollo - Setha [1, 2, 3, ..., n] se na le kakaretso ea n! litumello tse ikhethang. Ka ho thathamisa le ho ngola litumello tsohle ka tatellano, re fumana tatellano e latelang ea n = 3: "123" "132" "213" "231" "312" "321" Ho fanoe ka n le k, khutlisetsa tatellano ea kth ea tumello. Mohlala oa Tlhahlobo ea 1: Kenyelletso: n ...

Bala haholoanyane

Potso ea 223. Batla Litlhahiso System LeetCode Tharollo Tlhaloso ea Bothata Litlhahiso tsa Litlhahiso System LeetCode Tharollo - U fuoa mefuta e mengata ea lihlahisoa tsa likhoele le thapo searchWord. Etsa mokhoa o fanang ka maikutlo a bonyane mabitso a mararo a lihlahisoa ho tsoa lihlahisoa ka mor'a hore mongolo o mong le o mong oa searchWord o thaepe. Lihlahisoa tse sisintsoeng li tlameha ho ba le sehlongoapele se tšoanang le searchWord. Haeba ho na le lihlahisoa tse fetang tse tharo tse nang le ...

Bala haholoanyane

Potso ea 224. 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 225. Ho senya Aterese ea IP LeetCode Tharollo Phatlalatso ea Bothata Ho Hlakola Aterese ea IP Tharollo ea LeetCode - Ho fanoe ka aterese e nepahetseng (IPv4) IP, khutlisetsa phetolelo e senyehileng ea aterese eo ea IP. Aterese ea IP e silafetseng e nka sebaka sa nako e 'ngoe le e 'ngoe "." ka "[.]". Input: address = "1.1.1.1" Sephetho: "1[.]1[.]1[.]1" Tlhaloso Boikutlo bo bonolo haholo. 1. theha Stringbuilder str 2. loop ka khoele ea aterese ...

Bala haholoanyane

Potso ea 226. 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 227. Top K Mantsoe a Khafetsa LeetCode Tharollo Polelo ea Bothata Top K Mantsoe a Khafetsa Tharollo ea LeetCode - Ho fanoe ka lethathamo la mantsoe a likhoele le palo ea k, khutlisa likhoele tsa k khafetsa ka ho fetisisa. Khutlisetsa karabo e hlophisitsoeng ho ea ka lebelo ho tloha holimo ho ea tlase. Hlopha mantsoe ka makhetlo a tšoanang ho ea ka tatellano ea mantsoe a mantsoe. Mohlala oa Tlhahlobo oa 1: Kenyeletso: mantsoe = [“i”,”love”,”leetcode”,”i”,”love”,”coding”] k = 2 Sephetho: [“i”,”love”] Tlhaloso . ..

Bala haholoanyane

Potso ea 228. Ho eketsa Tharollo ea LeetCode ea Triplet Subsequence Polelo ea Bothata : Ho Eketseha ha Tharollo ea LeetCode ea Tharollo - Ho fanoe ka palo e feletseng ea palo, khutlela 'nete haeba ho na le li-indices tse tharo (i, j, k) tse kang <j <k le nums[i] < nums[j] < nums [k]. Haeba ho se na li-indices tse joalo, khutlisetsa bohata. Mohlala : Mohlala 1: Kenyeletso: lipalo = [2,1,5,0,4,6] Sephetho: Tlhaloso ea 'nete: The ...

Bala haholoanyane

Potso ea 229. Array Nesting Leetcode Tharollo Problem Statement Array Nesting Leetcode Solution – O fuwa palo e felletseng ya palo ya bolelele ba palo n moo dinomoro e leng pheteletso ya dinomoro mothating wa [0, n - 1]. O lokela ho aha sete s[k] = {NUMs[k], nums[k]], nums[Nums[k]]], ... } e ipapisitse le molao o latelang: Karolo ea pele ho s [k] e qala ka khetho ea ...

Bala haholoanyane

Potso ea 230. 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 231. Ho Fetola Li-Node ho Tharollo ea Leetcode ea Lethathamo le Hokahaneng Tlhaloso ea Bothata Ho Fetola Li-Node Lethathamong le Kopantsoeng Tharollo ea Leetcode - U fuoa hlooho ea lenane le amanang, le palo e feletseng k. Khutlisetsa hlooho ea lenane le amanang ka mor'a ho fetola litekanyetso tsa kth node ho tloha qalong le node ea kth ho tloha ho pheletso (lethathamo le thathamisitsoe ka 1). Mohlala: Kenyeletso: hlooho = [1,2,3,4,5], k = 2 ...

Bala haholoanyane

Potso ea 232. Tlosa Max Number of Edges ho boloka Graph Fully Traversable Leetcode Solution Phatlalatso ea Bothata Tlosa Bophahamo ba Maemo ho Boloka Kerafo e Felletseng ka ho Fetisisa Leetcode Tharollo- Alice le Bob ba na le graph e sa lebelloang ea n nodes le mefuta ea 3 ea metse: Mofuta oa 1: E ka tšeloa ke Alice feela. Mofuta oa 2: E ka tšeloa ke Bob feela. Mofuta oa 3: E ka tšeloa ka bobeli ...

Bala haholoanyane

Potso ea 233. Hlakola Node ho Tharollo ea Leetcode ea Lethathamo le Hokahaneng Phatlalatso ea Bothata : Hlakola Node Lethathamong le Kopantsoeng Tharollo ea Leetcode - Ngola mosebetsi oa ho hlakola node lethathamong le le leng le amanang le le leng. U ke ke ua fuoa monyetla oa ho fumana hlooho ea lenane, ho fapana le moo, u tla fuoa monyetla oa ho fumana node e lokelang ho hlakoloa ka kotloloho. Ho netefalitsoe hore node e tla hlakoloa ha e ...

Bala haholoanyane

Potso ea 234. Ugly Number II Tharollo ea LeetCode Phatlalatso ea Bothata Nomoro e Mobe II Tharollo ea LeetCode - Nomoro e mpe ke palo e ntle eo lintlha tsa eona tsa mantlha li lekanyelitsoeng ho 2, 3, le 5. Ho fanoe ka palo e feletseng ea n, khutlisetsa nomoro ea nth e mpe. Kenyelletso: n = 10 Sephetho: 12 Tlhaloso: [1, 2, 3, 4, 5, 6, 8, 9, 10, 12] ke tatellano ea 10 ea pele ...

Bala haholoanyane

Potso ea 235. Motsoako Sum IV LeetCode Tharollo Motsoako oa Setatemente sa Bothata Sum IV LeetCode Solution - Ka lebaka la palo e fapaneng ea linomoro tse felletseng le palo e felletseng ea sepheo, khutlisetsa palo ea metsoako e ka bang teng e kopanyang sepheo. Liteko tsa liteko li hlahisoa e le hore karabo e ka lekana palo ea 32-bit. Kenyelletso: lipalo = [1,2,3], target = 4 Sephetho: 7 Tlhaloso: Tse ka khonehang ...

Bala haholoanyane

Potso ea 236. String to Integer (atoi) LeetCode Tharollo Polelo ea Bothata The String to Integer (atoi) Leetcode Solution -"String to Integer (atoi)" e bolela hore Ho kenya ts'ebetsong myAtoi(string s), e fetolang khoele ho palo e saenneng ea 32-bit (e ts'oanang le ts'ebetso ea atoi ea C/C ++ ). Algorithm bakeng sa myAtoi(string s) e tjena: Bala 'me u hlokomolohe sebaka sefe kapa sefe se etellang pele se tšoeu. Sheba hore na sebapali se latelang (haeba ...

Bala haholoanyane

Potso ea 237. 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 238. Integer Break LeetCode Tharollo Polelo ea Bothata Integer Break LeetCode Tharollo - Ho fanoe ka palo e feletseng n, e arole ka kakaretso ea k positive integers, moo k >= 2, 'me u eketse sehlahisoa sa linomoro tseo. Re hloka ho Khutlisa sehlahisoa se phahameng seo re ka se fumanang. Kenyelletso: n = 2 Sephetho: 1 Tlhaloso: 2 = 1 + 1, ...

Bala haholoanyane

Potso ea 239. Boholo ba Sehlahisoa sa Splitted Binary Tree LeetCode Tharollo Polelo ea Bothata Boholo ba Sehlahisoa sa Splitted Binary Tree LeetCode Tharollo - Ho fanoe ka motso oa sefate sa binary, arola sefate sa binary hore e be li-subtrees tse peli ka ho tlosa bohale bo le bong e le hore sehlahisoa sa lipalo-palo tsa subtrees se be maximized. Khutlisetsa sehlahisoa se phahameng sa lipalo tsa li-subtrees tse peli. ...

Bala haholoanyane

Potso ea 240. Symmetric Tree LeetCode Tharollo Leetcode Tharollo Tlhaloso ea Bothata The Symmetric Tree LeetCode Tharollo - "Symmetric Tree" e bolela hore ho fanoe ka motso oa sefate sa binary 'me re hloka ho hlahloba hore na sefate sa binary se fanoeng ke seipone sa sona (symmetric ho pota setsi sa sona) kapa che? Haeba E, re hloka ho khutlisa 'nete ho seng joalo, leshano. Mohlala: ...

Bala haholoanyane

Potso ea 241. Bonyane bo Tsamaisa ho Equal Array Elements LeetCode Tharollo Polelo ea Bothata Bonyane bo Tsamaisa ho Equal Array Elements Tharollo ea LeetCode - Ho fanoe ka palo e felletseng ea palo ea boholo ba n, khutlisetsa palo e fokolang ea metsamao e hlokahalang ho etsa hore likarolo tsohle tsa sehlopha li lekane. Ka ts'ebetso e le 'ngoe, u ka eketsa n - 1 likarolo tsa sehlopha ka 1. Mohlala 1: Kenyelletso 1: lipalo = [1, 2, 3] Sephetho: ...

Bala haholoanyane

Potso ea 242. Jump Game Leetcode Tharollo Tlhaloso ea Bothata Papali ea Leetcode Tharollo - U fuoa palo e felletseng ea palo. Qalong u behiloe lethathamong la pele la sehlopha, 'me ntho e' ngoe le e 'ngoe e hlophisitsoeng e emela bolelele ba hao ba ho qhomela boemong boo. Khutlisetsa 'nete haeba u ka fihlela index ea ho qetela, kapa ho seng joalo e fosahetseng. Mohlala: Kenyeletso 1: linomoro = [2, ...

Bala haholoanyane

Potso ea 243. Lethathamo le Kopantsoeng la Cycle II LeetCode Tharollo Phatlalatso ea Bothata Lethathamo le Kopantsoeng Lethathamo la II LeetCode Tharollo - Ho fanoe ka hlooho ea lethathamo le amanang, khutlisetsa node moo potoloho e qalang teng. Haeba ho se na potoloho, khutlela null. Ho na le potoloho lethathamong le hokahaneng haeba ho na le node lethathamong le ka fihlellehang hape ka ho tsoela pele ...

Bala haholoanyane

Potso ea 244. Champagne Tower LeetCode Tharollo Tlhaloso ea Bothata Champagne Tower LeetCode Tharollo - Re kenya likhalase ka piramite, moo mola oa pele o nang le khalase ea 1, mola oa bobeli o na le likhalase tse 2, joalo-joalo ho fihlela mola oa 100. Khalase e 'ngoe le e' ngoe e na le kopi e le 'ngoe ea champagne. Joale, champagne e 'ngoe e tšeloa ka khalase ea pele ka holimo. Ha khalase ea holimo e tletse, leha e le efe ...

Bala haholoanyane

Potso ea 245. Bitwise LE ea Numere Range LeetCode Tharollo Polelo ea Bothata Bitwise LE ea Linomoro Range LeetCode Tharollo - Ho fanoe ka linomoro tsa 2 ka ho le letšehali le ka ho le letona tse emelang mefuta e fapaneng [ka ho le letšehali, ka ho le letona], re tlameha ho fumana bitwise LE ea linomoro tsohle ho tloha ho le letšehali ho ea ho le letona (ka bobeli li kenyelelitsoe) Mehlala & Tlhaloso Mohlala 1: Kenyelletso: leqele = 5, le letona = 7 ...

Bala haholoanyane

Potso ea 246. Excel Sheet Column Sehlooho sa LeetCode Tharollo Polelo ea Bothata Excel Sheet Column Title LeetCode Tharollo - Re filoe nomoro ea kholomo (ha re e bitse colNum) mme re hloka ho khutlisa sehlooho sa eona sa kholomo se lumellanang joalo ka ha se hlaha leqepheng la excel Mohlala A -> 1 B -> 2 C -> 3 … Z -> 26 AA ...

Bala haholoanyane

Potso ea 247. Tharollo e sebetsang ea Perfect Square LeetCode Polelo ea Bothata E na le Tharollo e Phethahetseng ea LeetCode e Phethahetseng - Ha ho fanoe ka palo e kholo ea palo e nepahetseng, ngola mosebetsi o khutlisang 'Nete haeba num e le sekoere se phethahetseng Bohata. Latela: Se ke oa sebelisa tšebetso efe kapa efe ea laebrari e hahelletsoeng kahare joalo ka sqrt. Kenyelletso: num = 16 Sephetho: Tlhaloso ea 'nete Moeli oa tharollo ea rona o tsitsitse. ka nomoro efe kapa efe ...

Bala haholoanyane

Potso ea 248. Fumana Li-sub-arrays tse peli tse sa thulaneng E 'ngoe le e 'ngoe e nang le Target Sum LeetCode Solution Polelo ea Bothata Fumana Mekhatlo e Mebeli e sa Oananeng Ka E 'ngoe le E 'ngoe E Na le Target Sum LeetCode Solution - "Fumana Li-sub-arrays tse Peli tse sa Oananeng E 'ngoe le e 'ngoe e Na le Sum ea Sepheo" e re u fuoa palo e felletseng ea palo le sepheo se felletseng, mosebetsi mona ke. ho fumana li-subarrays tse peli tse sa feteng ho tsoa ho palo e fapaneng hoo ...

Bala haholoanyane

Potso ea 249. Kopanya Lifate tse peli tsa Binary LeetCode Tharollo Polelo ea Bothata Kopanya Lifate tse peli tsa Binary LeetCode Solution - U fuoa lifate tse peli tsa binary root1 le root2. Ak'u nahane hore ha u beha e 'ngoe ea tsona hore e koahele e 'ngoe, li-node tse ling tsa lifate tse peli li pota-potile ha tse ling li sa koahele. U hloka ho kopanya lifate tse peli ho ...

Bala haholoanyane

Potso ea 250. Latelang Greater Element III LeetCode Tharollo Polelo ea Bothata Bothata, Next Greater Element III LeetCode Solution e bolela hore o fuoa palo e kholo ea n 'me o hloka ho fumana palo e kholo e latelang o sebelisa linomoro tse teng ho n feela. Haeba ho se na palo e joalo, u lokela ho hatisa -1. Ho feta moo, e ncha ...

Bala haholoanyane

Potso ea 251. Bonyane Chelete ea ho Tsamaisa Chips Sebakeng se Tšoanang sa LeetCode Tharollo Phatlalatso ea Bothata Chelete e Nyenyane ea ho Tsamaisa Li-Chips Sebakeng se Tšoanang sa LeetCode Tharollo - "Bonyane Chelete ea ho Tsamaisa Chips ho ea Boemong bo Tšoanang" e bolela hore u na le n chips, moo boemo ba ith chip e leng boemo[i]. U hloka ho tsamaisa li-chips tsohle sebakeng se le seng. Ka mohato o le mong, re ...

Bala haholoanyane

Potso ea 252. Fumana Likopi Tsohle ho Array LeetCode Tharollo Polelo ea Bothata Bothata, Find All Duplicates in an Array LeetCode Solution e bolela hore o fuoa mefuta e mengata ea boholo ba n e nang le likarolo tse fapaneng [1,n]. Nomoro e 'ngoe le e 'ngoe e ka hlaha hang kapa habeli 'me u hloka ho fumana likarolo tsohle tse hlahang habeli lethathamong. Mehlala...

Bala haholoanyane

Potso ea 253. Tsamaisa Zeroes LeetCode Tharollo Problem Statement Bothata, Move Zeroes LeetCode Solution e bolela hore o filwe lethathamo le nang le lefela le dielemente tse senang lefela mme o hloka ho tsamaisa zero qetellong ya letoto, o boloke tatellano e lekanyeditsweng ya dintho tse seng lefela mothalong. . U boetse u hloka ho kenya ts'ebetsong sebakeng sa ...

Bala haholoanyane

Potso ea 254. Tharollo ea Leetcode ea Nomoro e le 'Ngoe Polelo ea Bothata Tharollo ea Nomoro e le 'Ngoe ea Leetcode - Re fuoa lethathamo le se nang letho la linomoro 'me re hloka ho fumana ntho e hlahang hang feela. Ho fanoe ka potso ea hore element e 'ngoe le e 'ngoe e hlaha habeli ntle le e le' ngoe. Mohlala 1: Kenyeletso: lipalo = [2,2,1] Sephetho: 1 Mohlala 2: Kenyelletso: ...

Bala haholoanyane

Potso ea 255. 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 256. 01 Matrix LeetCode Tharollo Polelo ea Bothata Bothateng bona 01 Matrix LeetCode Solution, re hloka ho fumana sebaka sa 0 e haufinyane bakeng sa sele ka 'ngoe ea matrix e fanoeng. Matrix e na le 0 le 1 feela mme sebaka sa lisele tse peli tse haufi ke 1. Mehlala Mohlala 1: Kenyelletso: mat = ...

Bala haholoanyane

Potso ea 257. 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 258. Molumo o molelele ka ho Fetisisa o nang le Tharollo ea LeetCode ka Litlhaku tse K tse Ka ho Fetisisa Polelo ea Bothata Molumo o molelele ka ho Fetisisa o nang le Ka ho Fetisisa Ka Litlhaku Tse Khethollang LeetCode Tharollo - Ho fanoe ka khoele S le palo e felletseng ea K, khutlisetsa bolelele ba khoele e telele ka ho fetesisa ea S e nang le boholo ba litlhaku tse ikhethang tsa K. Mohlala: Nyeoe ea Teko ea 1: Kenyelletso: S = “bacc” K = 2 Sephetho: 3 Taba ea 2 ea Teko: Kenyo: S = “ab” ...

Bala haholoanyane

Potso ea 259. Nahana ka Tharollo ea LeetCode e Phahameng kapa e Tlase Phatlalatso ea Bothata Nahana Nomoro e Phahameng kapa e Tlase ea LeetCode Tharollo - Re bapala papali ea Guess. Papali e tjena: Ke khetha nomoro ho tloha ho 1 ho ea ho n. U tlameha ho hakanya hore na ke khethile nomoro efe. Nako le nako ha u nahana hore ho fosahetse, ke tla u joetsa hore na nomoro ea ka ...

Bala haholoanyane

Potso ea 260. Fetola Array e Hlophisitsoeng ho Binary Search Tree LeetCode Solutions Problem Statement Convert Sorted Array to Binary Search Tree LeetCode Solutions e re ho fanoe ka palo e felletseng ea palo moo lielemente li hlophisoang ka tatellano e nyolohang, e fetole hore e be sefate sa ho batla se leka-lekaneng sa binary. Sefate sa binary se leka-lekaneng ke sefate sa binary moo botebo ba li-subtrees tse peli tsa node e 'ngoe le e' ngoe ha bo fapane ho feta ...

Bala haholoanyane

Potso ea 261. Lentsoe Ladder LeetCode Tharollo Polelo ea Bothata Lentsoe la Lere la LeetCode Tharollo - "Lere la Mantsoe" le bolela hore u fuoa khoele e qalangWord, string endWord, le wordList. Re hloka ho fumana bolelele bo bokhutšoane ba tatellano ea phetoho (haeba ho se na tsela e teng, hatisa 0) ho tloha StartWord to EndWord ho latela maemo a fanoeng: All the Intermediate Words should ...

Bala haholoanyane

Potso ea 262. Sefate se le seng sa LeetCode Tharollo Polelo ea Bothata Bothata Same Tree e re Ho fanoe ka metso ea lifate tse peli tsa binary p le q, ngola mosebetsi ho hlahloba hore na lia tšoana kapa che. Lifate tse peli tsa binary li nkoa li tšoana haeba li tšoana ka sebopeho, 'me li-node li na le boleng bo tšoanang. Mohlala: Nyeoe ea Teko ...

Bala haholoanyane

Potso ea 263. Last Stone Weight II Tharollo ea LeetCode Problem Statement Bothata Last Stone Weight II e re o fuoa lethathamo la majoe a feletseng moo majoe[i] e leng boima ba lejoe la ith. Re bapala papali ka majoe. Lekhetlong le leng le le leng, re khetha majoe leha e le afe a mabeli ebe re a pshatla hammoho. A re re majoe a na le boima ba x le y ...

Bala haholoanyane

Potso ea 264. Spiral Matrix LeetCode Tharollo Problem Statement Spiral Matrix Problem e re Ho Spiral Matrix re batla ho hatisa likarolo tsohle tsa matrix ka mokhoa oa spiral ka tsela ea clockwise. Mokhoa oa Spiral Matrix: Idea Bothata bo ka kengoa ts'ebetsong ka ho arola matrix ka loops le ho hatisa likarolo tsohle ho e 'ngoe le e 'ngoe ...

Bala haholoanyane

Potso ea 265. Tlosa Likopi ho Tharollo e Hlophisitsoeng ea Leetcode Polelo ea Bothata The Tlosa Likopi ho tsoa ho Sorted Array Leetcode Solution - e re u fuoa palo e felletseng e hlophisitsoeng ka tatellano e sa theoheng. Re hloka ho tlosa likarolo tsohle tse qotsitsoeng le ho fetola lethathamo la mantlha e le hore tatellano e lekanyelitsoeng ea likarolo tse ikhethileng e lule e tšoana, 'me re tlaleha boleng ba ...

Bala haholoanyane

Potso ea 266. Tharollo e telele ka ho fetisisa ea Palindromic Substring LeetCode Polelo ea Bothata The Longest Palindromic Substring LeetCode Solution - "Longest Palindromic Substring" e re U Fuoa khoele s, khutlisetsa substring e telele ka ho fetisisa ea palindromic ka s. Tlhokomeliso: Palindrome ke lentsoe le balehang joalo ka morao le ho ea pele, mohlala, mofumahali. Mohlala: s = "babad" "bab" Tlhaloso: Tsohle ...

Bala haholoanyane

Potso ea 267. Nako e Molemohali ea ho Reka le ho Rekisa Stock LeetCode Solution Polelo ea Bothata Nako e Molemohali ea ho Reka le ho Rekisa Stock LeetCode Tharollo - "Nako e Molemo ka ho Fetisisa ea ho Reka le ho Rekisa Stock" e bolela hore U fuoa lethathamo la litheko moo litheko[i] e leng theko ea thepa e fanoeng ka letsatsi la ith. U batla ho eketsa phaello ea hau ka ho khetha ...

Bala haholoanyane

Potso ea 268. Bohareng ba Mekhatlo e Mebeli e Hlophisitsoeng Tharollo ea LeetCode Polelo ea bothata Median of Two Sorted Arrays LeetCode solution - Bothateng ba "Median of Two Sorted Arrays", re fuoa lihlopha tse peli tse hlophisitsoeng nums1 le nums2 tsa boholo ba m le n ka ho latellana, 'me re tlameha ho khutlisetsa bohareng ba lihlopha tse peli tse hlophisitsoeng. Kakaretso ea nako ea ho matha e lokela ho ba O(log (m+n)). Mohlala oa linomoro1 = [1,3], ...

Bala haholoanyane

Potso ea 269. Palo ea Lihlekehleke tsa LeetCode Tharollo Polelo ea Bothata Palo ea Lihlekehleke tsa LeetCode Tharollo – “Palo ea Lihlekehleke” e bolela hore u fuoa mxn 2D binary grid e emelang 'mapa oa '1's (naha) le '0's (metsi), o tlameha ho khutlisa palo ea lihlekehleke. Sehlekehleke se pota-potiloe ke metsi 'me se ...

Bala haholoanyane

Potso ea 270. 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 271. 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 272. 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 273. Tharollo ea Hamming Distance Leetcode Polelo ea Bothata Bothateng bona, re fuoa linomoro tse peli, A le B, 'me sepheo ke ho fumana sebaka se pakeng tsa linomoro tse fuoeng. Linomoro li kholo ho feta hore / li lekana le 0 ebile li ka tlase ho 231 Mohlala oa Pele oa Kakaretso = 5, Bobeli ba Bobeli = 2 3 Kakaretso ea Pele ...

Bala haholoanyane

Potso ea 274. Tlhaloso ea Leetcode Solution ea Sheet Column Sheet Polelo ea Bothata Bothateng bona ho fanoa ka linomoro tse nepahetseng tse emelang nomoro ea kholomo ea letlapa la Excel, re tlameha ho khutlisa sehlooho sa eona sa kholomo se tšoanang le se hlahang lethathamong la Excel. Mohlala # 1 28 "AB" # 2 701 "ZY" Katamelo Bothata bona ke mokokotlo oa bothata ho ...

Bala haholoanyane

Potso ea 275. Motsoako oa Tharollo ea Leetcode Bothata ba Motsoako oa Leetcode Solution bo re fa linomoro tse peli, n, le k. Re bolelloa hore re hlahise tatellano eohle e nang le likarolo tsa k tse khethiloeng linthong tsa 1 ho isa ho n. Re khutlisa tatellano ena ka bongata. Ha re fetiseng ka mehlala e 'maloa ho fumana ...

Bala haholoanyane

Potso ea 276. Tharollo ea mahakoe le majoe a Leetcode Bothata ba Jewels le Stones Leetcode Solution bo re o fuoe likhoele tse peli. E 'ngoe ea tsona e emetse mahakoe' me e 'ngoe ea tsona e emela majoe. Khoele e nang le mahakoe e emela litlhaku tseo e leng mabenyane. Re hloka ho fumana palo ea litlhaku khoeleng ea majoe tse ...

Bala haholoanyane

Potso ea 277. 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 278. Boholo bo tebileng ba Tharollo ea Binary Tree Leetcode Polelo ea Bothata Bothateng ho fanoa ka sefate sa binary mme re tlameha ho fumana botebo bo boholo ba sefate se fanoeng. Botebo ba sefate sa binary ke palo ea li-node tse tseleng e telele ho feta ho tloha motso oa motso ho fihla node e hole haholo ea lekhasi. Mohlala 3 / ...

Bala haholoanyane

Potso ea 279. Potoloha Lethathamo la Leetcode Tharollo Bothata ba Rotate List Leetcode Solution bo re fa lethathamo le hokahaneng le palo e felletseng. Re bolelloa hore re fetole lenane le hokahanngoeng ka ho le letona ke libaka tsa k. Kahoo haeba re potoloha lenaneng le hokahaneng k libakeng tse ka ho le letona, mohatong o mong le o mong re nka ntho ea hoqetela ho tsoa ho ...

Bala haholoanyane

Potso ea 280. 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 281. Fumana Phapang ea Leetcode Tharollo Polelo ea bothata Bothateng "Fumana Phapang" re fuoa likhoele tse peli s le t. String t e hlahisoa ka ho phuthela litlhaku tsa khoele s le ho eketsa semelo se le seng ka mokhoa o sa reroang. mosebetsi oa rona ke ho fumana sebopeho se kentsoeng ka khoele t. ...

Bala haholoanyane

Potso ea 282. 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 283. 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 284. 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 285. Fetolela Array Array ho Binary Search Tree Leetcode Tharollo Nahana hore re fuoe mefuta e mengata ea linomoro. Morero ke ho aha Binary Search Tree ho tsoa mofuteng ona hore sefate se lekane bolelele. Hlokomela hore ho thoe sefate se lekane bophahamo haeba phapang ea bophahamo ba li-subtrees tsa leqele le ho le letona tsa node efe kapa efe ho ...

Bala haholoanyane

Potso ea 286. Hlopha li-integer ka palo ea tharollo ea 1 Bit Leetcode Polelo ea bothata Bothateng "Hlopha li-Integer ka Palo ea 1 Bit," re fuoa lethathamo la tatellano. Mosebetsi oa rona ke ho hlophisa likarolo ka tatellano ho latela palo ea hanyane hanyane ka palo ea palo e nyolohang. Haeba tse pedi kapa ...

Bala haholoanyane

Potso ea 287. Tharollo e Thabisang Leetcode ea Nomoro Polelo ea Bothata Bothata ke ho lekola hore na nomoro e thabile kapa che. Nomoro ho thoe ke nomoro e thabileng haeba e nkela sebaka sebaka ka kakaretso ea lisekoere tsa linomoro tsa eona, mme ho pheta ts'ebetso ho etsa hore palo e lekane le 1. haeba e sa ...

Bala haholoanyane

Potso ea 288. Nako e molemohali ea ho reka le ho rekisa li-stock ka Cooldown Leetcode Solution Polelo ea bothata Bothateng ba "Nako e Ntle ea ho Reka le ho Rekisa Stock le Cooldown" re fuoa lethathamo moo karolo ka 'ngoe sehlopheng sena e nang le theko ea setoko se fanoeng ka letsatsi leo. Ha ho na thibelo palo ea lits'ebetso. Tlhaloso ea thekiso ke ...

Bala haholoanyane

Potso ea 289. Tlosa node ea Nth ho tloha pheletsong ea lenane le hokahaneng le fanoeng Polelo ea Bothata Bothata "Tlosa node ea Nth ho tloha pheletsong ea lenane le hokahaneng le fanoeng" e re o filoe lenane le hokahaneng le li-node tse ling. Mme joale o hloka ho tlosa node node ho tloha pheletsong ea lenane le hokahaneng. Mohlala 2-> 3-> 4-> 5-> 6-> 7 hlakola node ea 3rd ho 2-> 3-> 4-> 6-> 7 Tlhaloso: ...

Bala haholoanyane

Potso ea 290. Nomoro e thabileng Polelo ea Bothata Ke palo efe e thabileng? Nomoro ke nomoro e thabileng haeba re ka fokotsa palo e fanoeng hore e be 1 kamora ts'ebetso ena: -> Fumana kakaretso ea sekwere sa linomoro tsa nomoro e fanoeng. Tlosa kakaretso ena ka nomoro ea khale. Re tla pheta sena ...

Bala haholoanyane

Potso ea 291. Nomoro ea Palindrome Polelo ea Bothata bothata "Palindrome Number" e re o fuoa nomoro e felletseng. Lekola hore na ke palindrome kapa che. Rarolla bothata bona ntle le ho fetolela nomoro e fanoeng hore e be khoele. Mohlala 12321 Tlhaloso ea 'nete 12321 ke palo ea palindrome hobane ha re khutlisa 12321 e fana ka 12321 ...

Bala haholoanyane

Potso ea 292. Bala lipara ho tsoa lethathamong le hokahaneng leo kakaretso ea lona e lekanang le boleng bo fuoeng Polelo ea Bothata Bothata "Bala lipara tse tsoang lenaneng tse peli tse hokahaneng tseo palo ea tsona e lekanang le boleng bo fuoeng" bolela hore o fuoe manane a mabeli a hokahanngoeng le kakaretso ea boleng bo felletseng. Polelo ea mathata e kopiloe ho fumana hore na ke lipalo tse kae tse nang le chelete e lekanang le boleng bo fanoeng. Mohlala ...

Bala haholoanyane

Potso ea 293. Palo e nyane ea ho tlola ho fihlela qetellong Polelo ea Bothata Ha re re u na le palo e felletseng ea linomoro, 'me karolo ka' ngoe ea sehlopha e bontša palo ka 'ngoe e le ho tlola ho hoholo ho ka nkoang ho tloha ntlheng eo. Mosebetsi oa hau ke ho fumana palo e tlase ea ho tlola ho fihlela pheletso, ke hore, bonyane ba litheko tse ka nkuoang ...

Bala haholoanyane

Potso ea 294. Nako e telele ka ho fetisisa e ntseng e eketseha Re fuoa linomoro tse ngata tse sa hlophisoang 'me re tlameha ho fumana nako e telele ka ho fetisisa e ntseng e eketseha. Boemo bona ha bo hloke ho latellana Boemo bo tla eketseha A re utloiseng hantle hore ka mehlala e 'maloa. Keletso ea mohlala [9, 2, 5, 3, 7, 10, 8] Sephetho sa 4 ...

Bala haholoanyane

Potso ea 295. 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 296. 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 297. 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 298. 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 299. Palo ea likotoana tse 1 Kaofela re utloile ka Boima ba Hamming ba nomoro ea binary. Boima ba hammer ke palo ea li-bits / 1s tse behiloeng ka palo ea binary. Bothateng bona Palo ea likotoana tse 1 re tlameha ho fumana boima ba palo ea nomoro e fanoeng. Mehlala Palo = 3 Binary emela = 011 ...

Bala haholoanyane

Potso ea 300. 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 301. Liphetoho tsa li-Node tsa K-Group Bothata ba ho Fetoha Node ho bothata ba K-Group re file lenane le hokahaneng, Khutlisa lenane le hokahaneng sehlopheng sa k ebe u khutlisa lenane le fetotsoeng. Haeba li-node li se na li-k tse ngata joale khutlisa li-node tse setseng. Boleng ba k bo lula bo le nyane kapa bo lekana le ...

Bala haholoanyane

Potso ea 302. Lejoe Game LeetCode Bothata ba Game Game ke bofe? LeetCode ea Lejoe la Lejoe - Libapali tse peli A le B li bapala papali ea majoe. Ho na le lipalo tsa liqubu tse ngata tse nang le majoe a mang 'me majoe kaofela a liqubu tsohle a makatsa. A le B ba tlameha ho khetha qubu e le ...

Bala haholoanyane

Potso ea 303. 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 304. Ho hloa litepisi Polelo ea Bothata Bothata "Ho hloa litepisi" ho bolela hore o fuoa litepisi tse nang le litepisi. Ka nako o ka hloa setepisi se le seng kapa litepisi tse peli. Ke linomoro tse kae tsa litsela tsa ho fihla holima litepisi? Mohlala 3 3 Tlhaloso Ho na le mekhoa e meraro ea ho hloa ...

Bala haholoanyane

Potso ea 305. Linomoro tsa Boithaopo Nomoro e tsejoa e le linomoro tse ikarolang haeba - 1. Mod ea nomoro e 'ngoe le e' ngoe ea nomoro e nang le nomoro ke zero. 2. Nomoro e lokela ho ba le linomoro tsohle tseo eseng zero. Mohlala - 128 128% 1 = 0, 128% 2 = 0, 128% 8 = 0 ...

Bala haholoanyane

Potso ea 306. Khutlisa lenane le hokahaneng Polelo ea Bothata Bothata "ho fetola lenane le hokahaneng" e re re filoe hlooho ea lenane le hokahaneng. Re tlameha ho khutlisa lenane le hokahaneng ka ho fetola maqhama pakeng tsa bona le ho khutlisa hlooho ea lenane le hokahaneng le hokahaneng. Mohlala 10-> 20-> 30-> 40-> NULL NULL <-10 <-20 <-30 <-40 Tlhaloso Re khutlisitse sehokelo ...

Bala haholoanyane

Potso ea 307. Fumana Nth Node Polelo ea Bothata Bothateng ba "Fumana Nth Node" re fane ka lenane le hokahaneng ho fumana nth node. Lenaneo le lokela ho hatisa boleng ba data nth nth. N ke index ea palo e kenyelletsang. Mohlala 3 1 2 3 4 5 6 3 Katamelo E fuoe lenane le hokahaneng ...

Bala haholoanyane

Potso ea 308. Tlosa Ketsahalo ea hoqetela Polelo ea Bothata Bothateng ba "Tlosa Liketsahalo tsa ho Qetela" re fane ka lenane le hokahaneng. Ngola lenaneo ho hlakola ketsahalo ea ho qetela ea senotlolo se fanoeng lenaneng le hokahaneng. Lenane le ka ba le likopi. Mohlala 1 2 3 5 2 10 1 2 3 5 2 Katamelo e fuwe ...

Bala haholoanyane

Translate »