Lipotso tsa Puisano ea Amazon Coding

Lipotso tsa Puisano ea AmazonPin
Lipotso tsa Puisano ea Amazon

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

Bala haholoanyane

Potso ea 3. 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 4. 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 5. 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 6. 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 7. Palo ea Litaelo ho Backlog Leetcode Tharollo Polelo ea Bothata Palo ea Litaelo ho Backlog LeetCode Tharollo - "Palo ea Litaelo ho Backlog" e bolela hore ho fanoe ka 2D integer array [theko, chelete, orderType] e bolelang hore litaelo tsa chelete li behiloe ka mofuta oa mofuta oa taelo. Haeba mofuta oa odara ke: 0, e bolela ea hajoale ...

Bala haholoanyane

Potso ea 8. 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 9. Litsela Tse Ikhethang II Tharollo ea Leetcode Tlhaloso ea Bothata Litsela Tse Ikhethang II Tharollo ea LeetCode - "Litsela tse Ikhethang II" li bolela hore ho fanoe ka marang-rang a mxn moo roboto e qalang ho tloha ka holimo ho le letšehali la marang-rang. Re hloka ho fumana palo eohle ea litsela tsa ho fihla sekhutlong se ka tlase se letona sa marang-rang. ...

Bala haholoanyane

Potso ea 10. Batla Tharollo ea 2D Matrix II Leetcode Polelo ea Bothata Batla Tharollo ea 2D Matrix II LeetCode - "Batla 2D Matrix II" e u kopa ho fumana algorithm e sebetsang hantle e batlang sepheo sa boleng ho mxn integer matrix matrix. Linomoro moleng o mong le o mong, hammoho le kholomo, li hlophisoa ka tatellano e nyolohang. Mohlala: Kenyo: matrix = [[1,4,7,11,15],[2,5,8,12,19],[3,6,9,16,22],[10,13,14,17,24, 18,21,23,26,30],[5]], target = XNUMX Sephetho: nnete ...

Bala haholoanyane

Potso ea 11. Bolelele bo Holimo ba Khoele e Kopanetsoeng e nang le Tharollo ea Leetcode ea Litlhaku tse Ikhethang Polelo ea Bothata Bolelele bo Holimo ba Khoele e Kopanetsoeng e nang le Litlhaku tse Ikhethileng Tharollo ea LeetCode - "Bolelele bo Felletseng ba Khoele e Kopanetsoeng e nang le Litlhaku tse Ikhethileng" e re o filoe likhoele tse ngata mme o hloka ho khetha tatellano efe kapa efe ea lethathamo le fanoeng ebe o li kopanya. likhoele ho theha ...

Bala haholoanyane

Potso ea 12. Tharollo ea Leetcode ea Sebaka se Khutšoane ka ho Fetisisa Polelo ea Bothata The Shortest Word Distance LeetCode Solution - e re u fuoa letoto la likhoele le mantsoe a mabeli a fapaneng. Re hloka ho khutlisa sebaka se sekhutšoane pakeng tsa mantsoe ana a mabeli a hlahang khoeleng ea ho kenya. Mohlala: Kenyelletso: wordsDict = ["itloaetsa", "etsa", "perfect", "coding", "e etsa"], word1 = "coding", word2 = "itloaetsa" Sephetho: 3 Tlhaloso: Lentsoe “khouto” le hlaha ho boemo 4 ....

Bala haholoanyane

Potso ea 13. Karolelano ea ho falla ho tsoa ho Tharollo ea Leetcode ea Data Stream Phatlalatso ea Bothata Karolelano e Tsoang ho tloha Data Stream LeetCode Tharollo - "Moving Average from Data Stream" e bolela hore ho fanoe ka palo ea li-integers le boholo ba fensetere k. Re hloka ho bala karolelano e tsamaeang ea linomoro tsohle tse fensetereng e thellang. Haeba palo ea likarolo ho ...

Bala haholoanyane

Potso ea 14. 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 15. 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 16. Rala Stack ka Keketso ea Ts'ebetso ea Leetcode Tharollo Polelo ea Bothata Moralo oa Stack With Keketso Operation Leetcode Solution - e re re hloka ho rala stack e ts'ehetsang ts'ebetso e ka tlase ka nepo. Abela boholo ba bokhoni ba stack. Etsa ts'ebetso ea push hantle, haeba boholo ba stack bo le tlase haholo ho feta boholo ba matla a ...

Bala haholoanyane

Potso ea 17. Tharollo ea butle-butle ea Leetcode Bothata ba Slowest Key Leetcode Solution bo re fa tatellano ea linotlolo tse hatisitsoeng. Re boetse re fuoa lethathamo kapa vector ea linako tseo linotlolo tsena li lokolloang ka tsona. Ho latellana ha linotlolo ho fanoa ka mofuta oa khoele. Kahoo, bothata bo re kopile ho ...

Bala haholoanyane

Potso ea 18. 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 19. Kenya Tharollo ea Leetcode ea Nako Bothata ba ho kenya Interval Leetcode Solution bo re fa lethathamo la linako tse ling le karohano e le 'ngoe e arohaneng. Ebe re bolelloa hore re kenye karohano ena e ncha har'a lenane la linako. Kahoo, nako e ncha e kanna ea kopana le linako tse seng li ntse li le lenaneng, kapa e kanna ea ...

Bala haholoanyane

Potso ea 20. 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 21. Tharollo ea Leepcode ea Island Perimeter Polelo ea Bothata Bothateng bona, re fuoa gridi ka sebopeho sa sehlopha sa 2-D. grid [i] [j] = 0 e emela hore ho na le metsi ka nako eo mme grid [i] [j] = 1 e emela mobu. Lisele tsa grid li hokahane ka tsela e emeng / e tsepameng empa e se ka tsela e kopaneng. Ho na le sehlekehleke se le seng hantle (karolo e hokahaneng ea mobu ...

Bala haholoanyane

Potso ea 22. 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 23. Phetoho ea maemo a Tharollo ea Leetcode ea Lenane Bothata ba Transform of Array Leetcode Solution bo re file linomoro tse ngata. Sehlopha kapa tatellano e fanoeng ha ea hlophisoa. Re hloka ho beha lipalo ho palo e ngoe le e ngoe ka tatellano e fanoeng. Ho na le lithibelo tse ling bakeng sa ho abela maemo. Mekhahlelo e tlameha ho qala ka ...

Bala haholoanyane

Potso ea 24. Decompress Run-Length Encoded List Leetcode Tharollo Bothata ba Decompress Run-Length Encoded List Leetcode Solution e re o fuoe sehlopha kapa vector e nang le tatellano. Ho latellana ho na le boemeli bo itseng. Lethathamo la kenyelletso le thehiloe ho latela tatellano e ngoe. Re tla bitsa tatellano e ngoe joalo ka tatellano ea mantlha. Ho latela tatellano ea ho kenya ...

Bala haholoanyane

Potso ea 25. Tlosa Elements ka Tharollo e Kholohali ho Lehlakoreng la Leetcode Tharollo Bothata bo Tlosa Elements ka Greatest Element ka lehlakoreng le letona la Leetcode Solution e re fa lethathamo kapa vektara ea linomoro. Bothata bo re kopile ho khutlisa likarolo tsohle ka elemente e kholo ho feta likarolo tsohle tse ka lehlakoreng le letona. Kahoo nahana haeba re ne re na le ...

Bala haholoanyane

Potso ea 26. Fumana Mohlōli ho Tharollo ea Leetcode ea Tic Tac Toe Game Bothata ba Fumana Mohlophisi ho Tic Tac Toe Game Leetcode Solution e re kopa ho fumana hore na ke mang ea hapileng papali ea menoana ea matsoho. Bothata bo re fa lethathamo kapa li vector tse tsamaeang tse entsoeng ke libapali. Re hloka ho tsamaea le ho ahlola hore na ke mang ...

Bala haholoanyane

Potso ea 27. Fumana Tharollo ea Batho ba Tloaelehileng ea Leetcode Polelo ea Bothata Bothateng bona, re fuoa lenane la likhoele. Re tlameha ho fumana litlhaku tse tloaelehileng likhoeleng tsohle. Haeba sebapali se le teng ka likhoele tsohle ka makhetlo a mangata, re tla tlameha ho hlahisa semelo ka makhetlo a mangata. Ha re re, re na le tatellano ...

Bala haholoanyane

Potso ea 28. Nako e nyane ea ho etela tharollo ea lintlha tsohle tsa Leetcode Bothata ba Nako e Nyane ea ho Etela Lintlha Tsohle Leetcode Solution e re fa lethathamo kapa vector ea lintlha ka lilepe tse hokahanyang. Bothata kamora ho re fa maikutlo re kopa hore re fumane nako e tlase ea ho etela lintlha tsohle tse fanoeng. Ha o tsamaisa yuniti e le 'ngoe ...

Bala haholoanyane

Potso ea 29. 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 30. Karolo Array Likarolong Tse tharo Ka Tekano Sum Leetcode Tharollo Bothata ba Karolo e arohaneng likarolo tse tharo tse nang le tharollo e lekanang ea Leetcode Solution e re fa lethathamo kapa vector mme e botsa hore na ho na le likarolo tse tharo tse ka bang teng ka tatellano. Mona, ka karohano re bolela hore ho na le li-indices tse peli i, j joalo hore kakaretso ea likarolo ho tloha qalong ...

Bala haholoanyane

Potso ea 31. 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 32. 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 33. 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 34. E na le Tharollo ea Leetcode ea Duplicate II Polelo ea Bothata Bothateng bona re fuoa linomoro tse ngata 'me re tlameha ho sheba hore na ho na le likarolo tse kopitsoang tse ka bang bonyane k ho tse ling. ke hore phapang lipakeng tsa li-indices tsa lintho tse peli tse tšoanang e lokela ho ba tlase ho ...

Bala haholoanyane

Potso ea 35. 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 36. Fumana Mantsoe a Ka Thehoang ke Litlhaku Leetcode Tharollo Polelo ea bothata Bothateng "Fumana Mantsoe a ka Thehoang ke Litlhaku" re fuoa letoto la likhoele tse nang le lialfabeta tsa Senyesemane tse nyane (mantsoe) le khoele e nang le sehlopha sa litlhaku (chars). Mosebetsi oa rona ke ho sheba mohala ka mong ka har'a ...

Bala haholoanyane

Potso ea 37. Palo ea Tharollo ea Leetcode ea Li-Pairs tse lekana tsa Domino Polelo ea bothata Bothateng "Palo ea Li-Domino Pairs tse Lekanang," re fuoa lenane la li-dominoes moo domino e 'ngoe le e' ngoe e nang le litekanyetso tse peli tse kang li-dominoes [i] = [a, b]. Li-domino tse peli, li-domino [i] = [a, b] le li-domino [j] = [c, d] li lekana haeba (a == c le b == d) kapa (a == d le c == d) . Mosebetsi oa rona ke ho fumana ...

Bala haholoanyane

Potso ea 38. Tharollo ea Leetcode ea Pascal's Triangle II Polelo ea Bothata Bothateng bona re fuoe Row index (i) ea Pascal Triangle. Re tlameha ho theha mokoloko o nang le boleng ba mola ebe oa o khutlisa. Row index e qala ho tloha 0. Rea tseba hore Triangle ea Pascal ke khutlo-tharo moo nomoro e 'ngoe le e' ngoe e leng ...

Bala haholoanyane

Potso ea 39. 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 40. Palo ea tharollo ea Leetcode ea lipara tse ntle Polelo ea Bothata Bothateng bona ho fanoa ka linomoro tse ngata 'me re tlameha ho fumana palo ea palo ea lipara tse ntle (a [i], a [j]) moo [i] = a [j]. Mehlala nums = [1,2,3,1,1,3] 4 Tlhaloso: Ho na le lipara tse 4 tse ntle ho li-indices (0,3), (0,4), (3,4), (2,5). [1,1,1,1] 6 Tlhaloso: ...

Bala haholoanyane

Potso ea 41. Tharollo ea Boraro ea Boholo ba Leetcode Joalokaha sehlooho se bolela, sepheo ke ho fumana palo ea boraro e holimo ka bongata ba linomoro. Hlokomela hore re hloka ho fumana palo e arohaneng ea boraro e fapaneng ka bongata. Re khutlisetsa palo e kahodimodimo ea palo e felletseng ka bongata ha e sena palo e kholo ea boraro e kholo. Mohlala ...

Bala haholoanyane

Potso ea 42. Tharollo e leka-lekaneng ea Binary Tree Leetcode Sefate sa binary se leka-lekane ka Bophahamo haeba phapang ea bophahamo ba karoloana e ngoe le e ngoe ea sefate se ka ho le letona e ka ho fetisisa 1. Bothateng bona, re tla sheba sefate sa binary se leka-lekaneng. Mohlala 2/1/4 Ha e leka-lekane 1/2 ...

Bala haholoanyane

Potso ea 43. 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 44. 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 45. 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 46. 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 47. Bana ba nang le palo e kholo ka ho fetisisa ea tharollo ea lipompong Leetcode Bothateng ba "Bana ba nang le lipompong tse kholo ka ho fetesisa", re fuoa mefuta e mengata e emelang palo ea chokolete eo bana ba bang ba nang le eona le lipompong tse ling tse ka ajoang ka tsela efe kapa efe. Joale, re hloka ho fumana: Na ngoana e mong le e mong a ka ba le palo e kholo ka ho fetesisa ...

Bala haholoanyane

Potso ea 48. 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 49. 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 50. 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 51. Max Consecutive Ones Leetcode Tharollo Polelo ea Bothata Bothateng ba ho Fela ka tatellano ea mathata ho fanoa ka bongata ba li-binary. Re tlameha ho fumana palo e kaholimo ho tse latellanang tse teng ka har'a sehlopha se fanoeng. Lethathamo le kenyellelitsoeng le tla ba le 0 le 1. Mohlala [1,1,0,1,1,1] 3 Tlhaloso: Linomoro tse peli tsa pele kapa lipalo tse tharo tsa ho qetela ke ...

Bala haholoanyane

Potso ea 52. 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 53. Hlopha Array Ka Parity II Leetcode Tharollo Polelo ea bothata Bothateng "Sort Array By Parity II," re fuoa bonngoe moo likarolo tsohle e leng linomoro tse nepahetseng. Sehlopha se na le likarolo tse ngata. Lenane le na le palo e lekanang ea likarolo tse sa tloaelehang. Mosebetsi oa rona ke ho hlophisa likarolo ...

Bala haholoanyane

Potso ea 54. Bala lipara le Given Sum Bothateng "lipalo tse baloang le palo e fanoeng" re fane ka palo e felletseng [] 'me nomoro e' ngoe e re 'kakaretso', u tlameha ho tseba hore na ho na le likaroloana tse peli tse lenaneng le fuoeng chelete e lekanang le "kakaretso". Kenyelletso ea Mohlala: arr [] = {1,3,4,6,7} le sum = 9. Sephetho: "Lintho li fumanoe ...

Bala haholoanyane

Potso ea 55. 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 56. Phapang e kholo lipakeng tsa maqhubu a likarolo tse peli tse joalo ka hore ntho e nang le maqhubu a maholo le eona e kholo Ha re re o na le lenane le lekaneng. Polelo ea bothata e botsa ho fumana phapang e kholo lipakeng tsa makhetlo a likarolo tse peli tse arohaneng tsa sehlopha se fanoeng, empa ntlha e nang le makgetlo a maholo le eona e lokela ho ba ea bohlokoa ho feta palo e ngoe. Keletso ea Mohlala: arr [] = {2,4,4,4,3,2} ...

Bala haholoanyane

Potso ea 57. Fetisa kakaretso ea lenane kamora tharollo ea K Negations Leetcode Poso ena e ho Maximize Sum Of Array After K Negations Leetcode Solution Bothata ba polelo Bothateng "Maximize Sum Of Array After K Negations" re fuoa lethathamo le boleng K. Lenane le na le litekanyetso tse felletseng. Re ka fetola boleng ba arr [i] hore e be ...

Bala haholoanyane

Potso ea 58. Subrray e nyane ka ho fetisisa e nang le linomoro tse ikhethang Ha re re o na le palo e felletseng le palo k. Polelo ea bothata e kopa ho fumana mofuta o monyane ka ho fetisisa oa mefuta (l, r) ka kakaretso, ka tsela e joalo ho na le linomoro tse ikhethang tsa k tse fumanehang karolong e nyane ka ho fetisisa. Keletso ea Mohlala: {1, 2, 2, 3, 4, 5, 5} k = 3 ...

Bala haholoanyane

Potso ea 59. Likarolo tse tharo tse ikhethileng tse akaretsang boleng bo fanoeng Re fane ka palo ea linomoro le nomoro e fanoeng e bitsoang 'sum'. Polelo ea mathata e kopa ho fumana karoloana e kopantseng palo e fanoeng 'sum'. Kenyelletso ea Mohlala: arr [] = {3,5,7,5,6,1} kakaretso = 16 Sephetho: (3, 7, 6), (5, 5, 6) Tlhaloso: Triplet e lekanang le e fanoeng .. .

Bala haholoanyane

Potso ea 60. Subarray e telele ka ho fetesisa e nang le palo ea 1 e le ngoe ho feta palo ea 0s Re fane ka mefuta e mengata ea linomoro. Lenane le na le 1 le 0 feela. Polelo ea bothata e kopa ho fumana bolelele ba Sub-Array e telele ka ho fetesisa e nang le palo ea nomoro ea 1 e le 'ngoe ho feta palo ea 0 ka tatellano. Keletso ea Mohlala: arr [] = ...

Bala haholoanyane

Potso ea 61. Maximum Array ho tsoa ho tse peli tse fuoeng Arrays Keeping Order Same Ha re re re na le lihlopha tse peli tse lekanang tsa boholo bo lekanang n. Likarolo ka bobeli li ka ba le linomoro tse tloaelehileng. Polelo ea bothata e kopa ho theha sephetho se nang le litekanyetso tsa 'n' tse tsoang ho li-arrays ka bobeli. Sehlopha sa pele se lokela ho beoa pele (likarolo tsa pele ...

Bala haholoanyane

Potso ea 62. Palo ea nomoro e phahameng kapa e tlase II Polelo ea Bothata "Guess Number Higher or Lower II" e re re tlo bapala papali e bitsoang Guess Game. Papali e re ke khetha nomoro ho tloha 1 ho isa n. Nako le nako ha u hakanya nomoro eo ke sa e khethileng, ke re ho uena ...

Bala haholoanyane

Potso ea 63. 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 64. Khetholla li-0 le li-1 ho Array Tlhaloso ea Bothata Ha re re u na le lenane le le leng. Bothata "Khetholla li-0 le li-1 ka tatellano" e kopa ho arola sehlopha ka likarolo tse peli, ka 0 le ka 1. Li-0 li lokela ho ba ka lehlakoreng le letšehali la sehlopha le 1 ka lehlakoreng le letona la sehlopha. ...

Bala haholoanyane

Potso ea 65. Fumana kholo ka ho fetisisa d ho Array hoo a + b + c = d Polelo ea Bothata Ha re re u na le palo ea linomoro. Litekanyetso tsa ho kenya ke likarolo tsohle tse fapaneng. Bothata "Fumana kholo ka ho fetisisa d ka bongata hoo + b + c = d" e kopa ho fumana ntho e kholo ka ho fetisisa 'd' ka seteng hoo a + b + c = ...

Bala haholoanyane

Potso ea 66. 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 67. 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 68. Lipotso tsa Palo ea Likarolo tse Ikhethileng ka har'a Subarray Re fane ka lethathamo la palo e felletseng le lipotso tse 'maloa' me re tlameha ho fumana palo ea likarolo tsohle tse fapaneng tseo re nang le tsona ka har'a sebaka se fanoeng, potso e na le linomoro tse peli tse setseng le ho le letona, ona ke moeli o fanoeng, le sena sebaka se fanoeng re ...

Bala haholoanyane

Potso ea 69. Palo ea Palo ea Bonyane (Karohano ea Motsoako oa Square le Tafole e Nyane) Bothateng bo fokolang ba lipotso re fane ka potso le lenane le le leng. Potso ka 'ngoe e na le mefuta e le li-index tsa ho le letšehali le tse nepahetseng bakeng sa mokoloko ka mong. Mosebetsi o fanoeng ke ho fumana bonyane ba palo eohle e lutseng kahara. Keletso ea Mohlala: arr [] = {2, 5, ...

Bala haholoanyane

Potso ea 70. Palo ea Range Sum e sebelisa Sparse Table Potsong e akaretsang ea lipotso tse sebelisang bothata ba tafole e fokolang re na le lipotso tse fapaneng 'me re fuoe lenane le felletseng. Mosebetsi o fanoeng ke ho fumana kakaretso ea linomoro tsohle tse tlang ka bongata. Keletso ea Mohlala: arr [] = {1,4,6,8,2,5} Potso: {(0, 3), (2, 4), (1, 5)} Sephetho: 19 16 25 ...

Bala haholoanyane

Potso ea 71. Bala le ho Fetoha Lipotso ka Lenane la Binary Boholo ba boholo ba n bo fanoe e le boleng ba ho kenya. Bothata "Lipalo tsa ho Bala le ho Fetoha ho Binary Array" li kopa ho etsa tse ling tsa lipotso tse fanoeng ka tlase, lipotso li ka fapana ka mokhoa o sa reroang. Lipotso ke ⇒ Fetola lipotso ⇒ fapoha (qala, qetella), sena ...

Bala haholoanyane

Potso ea 72. Lipotso tsa boleng ba boleng bo phahameng ba likaroloana tsa karoloana ea Binary Ngola Lipotso bakeng sa boleng ba desimali ba li-subarrays tsa mabothobotho ka bongata ba li-binary. Polelo ea bothata e kopa ho fumana nomoro ea decimal e bileng teng ka thuso ea mefuta e fapaneng ea li-binary. Keletso ea Mohlala: arr [] = {1, 0, 1, 1, 0, 0, 1, 1} Potso (1, ...

Bala haholoanyane

Potso ea 73. Eketsa likarolo ho sebelisa lenane le leng Ha re re re fane ka linomoro tse peli tse lekanang tsa boholo bo lekanang n. Lihlopha tsena ka bobeli li na le linomoro tse ntle. Polelo ea bothata e kopa ho holisa sehlopha sa pele ka ho sebelisa karolo ea bobeli e bolokang karolo ea bobeli e le eona ea pele (likarolo tsa sehlopha sa bobeli li lokela ho hlaha pele ho tlhahiso). ...

Bala haholoanyane

Potso ea 74. Bonyane ba swaps bo hlokehang ho tlisa likarolo tsohle tlasa kapa ho lekana le k hammoho Bothata "Bonyane ba swaps bo hlokehang ho tlisa likarolo tsohle ka tlase ho kapa bo lekana le k hammoho" bo re o na le lenane le felletseng. Polelo ea mathata e kopa ho fumana lipalo tse nyane ka ho fetesisa tse tla hlokoa ho bokella likarolo tse tlase kapa tse lekanang ...

Bala haholoanyane

Potso ea 75. Fumana Boemo ba Pele le Bofelo ba Element ho Arged Array Leetcode Solution Polelo ea mathata Sehloohong sena se bitsitsoeng "Fumana Boemo ba Pele le Bofelo ba Element ho Sorted Array Leetcode Solution," re tla tšohla tharollo ea bothata ba leetcode. Bothateng boo re bo filoeng re fuoa lethathamo. Re boetse re fuoa sepheo sa sepheo. Lintho tse lenaneng li latellana ho ...

Bala haholoanyane

Potso ea 76. Tharollo ea Monotonic Array LeetCode Polelo ea mathata Bothateng ba "Monotonic Array" re fuoa lethathamo. Mosebetsi oa rona ke ho sheba hore na sehlopha ke mofuta oa monotonic kapa che. Sehlopha sa monotonic ke sehlopha moo likarolo li hlophisoang ka tatellano e ntseng e eketseha kapa ka tatellano e fokotsehang. Haeba sehlopha se hlophisitsoe ka ...

Bala haholoanyane

Potso ea 77. Boholo ba morao-rao bo latela hore ha ho tse tharo tse latellanang Bothata "Boholo ba tatellano e kholo ea hore ha ho tse tharo tse latellanang" bo re o fuoe lethathamo la linomoro. Hona joale o hloka ho fumana tatellano e nang le chelete e felletseng eo u ke keng oa e nahana ka likarolo tse tharo tse latellanang. Ho hopola, tatellano ha se letho haese sehlopha ...

Bala haholoanyane

Potso ea 78. 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 79. Lekola hore na lenane le na le linomoro tse kopaneng tse nang le likopi tse lumelletsoeng U fuoa linomoro tse ngata tse ka bang le likarolo tse tšoanang. Polelo ea bothata e botsa ho fumana hore na ke sehlopha sa linomoro tse kopaneng, hatisa "Ee" haeba ho joalo, hatisa "Che" haeba ho se joalo. Mohlala oa Keletso: [2, 3, 4, 1, 7, 9] Mohlala ...

Bala haholoanyane

Potso ea 80. Melao ea K e Mefokolo ka ho Fetisisa Tharollong ea Leetcode Polelo ea bothata Bothateng "The K Weakest Rows in a Matrix" re fuoa matrix ea mela le mela ea m. matrix e tletse ka 0 kapa 1. Ntho e ikhethang ka popeho ena ke hore kaofela ha tsona li shebile ka lehlakoreng le lets'ehali la mola o mong le o mong ...

Bala haholoanyane

Potso ea 81. Bokhoni ba ho tsamaisa liphutheloana ka har'a matsatsi a D Leetcode Solution Polelo ea bothata Bothateng "Matla a ho Romella Liphutheloana Matsatsing a D," re na le lipakete koung A tse lokelang ho fetisetsoa koung ea B matsatsing a D. re fuoa litekanyo tsa litekanyo tse nang le boima ba pakete ka 'ngoe le palo ea matsatsi ao re ...

Bala haholoanyane

Potso ea 82. U ka etsa tsoelo-pele ea lipalo ho tloha tatelanong ea tharollo ea Leetcode Polelo ea bothata Bothateng "E ka Etsa Hore Tsoelo-pele ea Arithmetic e Tsoele Pele ho tloha ka tatellano" re fuoe lethathamo, joale re hloka ho araba haeba ho khonahala ho hlahisa Progression ea Arithmetic ka ho hlophisa tatellano hape. Mohlala arr = [3,1,5] Tlhaloso ea 'nete: Re ka hlophisa sehlopha joalo ka {1,3,5} e etsang ...

Bala haholoanyane

Potso ea 83. 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 84. Nako e Ntle ea ho Reka le ho Rarolla Tharollo ea Leetcode ea Stock II Polelo ea bothata Bothateng ba "Nako e Ntle ea ho Reka le ho Rekisa Stock II," 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 85. Nako e molemohali ea ho reka le ho rekisa li-stock ka Transaction Fee Leetcode Solution Polelo ea bothata Bothateng "Nako e Ntle ea ho Reka le ho Rekisa stock ka Tefo ea Transaction," 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 86. Palo ea lipara tse nang le likarolo tse lekanang ka tatellano Ha re re re fane ka lenane le lekaneng. Bothata "Palo ea lipara tsa li-index tse nang le likarolo tse lekanang ka tatellano" e kopa ho fumana che ea li-indices (i, j) ka tsela eo arr [i] = arr [j] mme ke sa lekana le j . Mohlala arr [] = {2,3,1,2,3,1,4} 3 Tlhaloso lipara ...

Bala haholoanyane

Potso ea 87. Fumana kakaretso ea pokello ea likarolo tse ikhethileng bakeng sa sehlopha se fanoeng Ha re re u na le palo ea linomoro. Bothata "Fumana Kakaretso ea likarolo tsohle tse ikhethileng bakeng sa lethathamo le fanoeng" e kopa ho fumana kakaretso ea likarolo tsohle tse ikhethileng tsa likaroloana (Kakaretso ea likaroloana ke kakaretso ea likaroloana tsa sehlopha ka seng). Ka pokello e ikhethileng ea likaroloana, re ne re re re re ha ho na li-sub-array ...

Bala haholoanyane

Potso ea 88. Tsela e Nyane ea Kakaretso ho Boraro-bo-bong Polelo ea Bothata Bothata "Tsela e Nyane ea Kakaretso ea Boraro-bo-bong" e re o fuoa tatellano ka sebopeho sa likhutlo-tharo tsa linomoro. Joale ho qala ka mola o kaholimo, ke bokae bonyane boo u ka bo fihlelang ha o fihla moleng o ka tlase? Mohlala 1 2 3 5 ...

Bala haholoanyane

Potso ea 89. Letoto le lelelele ka ho fetesisa le se nang likarolo tse fetang K tse ikhethang Bothata "Larolo e telele ka ho fetesisa e se nang likarolo tse fetang K tse fapaneng" e re ha re re o na le linomoro tse ngata, polelo ea bothata e kopa ho fumana mofuta o molelele ka ho fetesisa o se nang boholo bo fetang ba likarolo tse fapaneng tsa k. Mohlala arr [] = {4, 3, 5, 2, 1, 2, 0, 4, 5} ...

Bala haholoanyane

Potso ea 90. Fuoa lethathamo la lipara Fumana lipara tsohle tse lumellanang ho eona Fumana lipara tsohle tse lumellanang - U fuoa lipara tse fapaneng. U tlameha ho fumana lipara tse lumellanang ho eona. Ho thoe lipara tse lumellanang li lekana ha lihlopha li re (a, b) le (c, d) moo 'b' e lekanang le 'c' le 'a' ke ...

Bala haholoanyane

Potso ea 91. Tshebetso e nyane ho etsa hore likarolo tsohle li lekane ka tatellano Bothata "Ts'ebetso e nyane ea ho etsa hore likarolo tsohle li lekane ka tatellano" e re o fuoe lethathamo le nang le linomoro tse ling ho lona. U tlameha ho fumana lits'ebetso tse tlase tse ka etsoang ho etsa sehlopha se lekanang. Mohlala [1,3,2,4,1] 3 Tlhaloso Ebang ho tlosoa ho 3 ho ka ba ...

Bala haholoanyane

Potso ea 92. Theha Binary Tree ho tsoa ho boemeli bo fanoeng ba Parent Array Bothata "Construct Binary Tree from fanoe ka setšoantšo sa Parent Array" bo re o fuoe lethathamo. Lethathamo lena la ho kenya le emela sefate sa binary. Hona joale o hloka ho aha sefate sa binary motheong oa sehlopha sena sa ho kenya. Sehlopha se boloka index ea node ea motsoali ho index ka 'ngoe. ...

Bala haholoanyane

Potso ea 93. Fumana subarray ka kakaretso e fuoeng (E sebetsana le linomoro tse fosahetseng) Bothata "Fumana subarray ka palo e fanoeng (E sebetsana le linomoro tse fosahetseng)" e re o fuoe palo e felletseng, e nang le linomoro tse fosahetseng hape le nomoro e bitsoang "kakaretso". Polelo ea mathata e kopa ho hatisa mofuta o ka tlase, o akaretsang palo e fanoeng e bitsoang "sum". Haeba ho na le lihlopha tse fetang bonngwe ...

Bala haholoanyane

Potso ea 94. 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 95. Bala palo ea makhetlo a mararo a nang le sehlahisoa se lekanang le nomoro e fanoeng Bothata "Palo ea palo ea tse tharo tse nang le sehlahisoa se lekanang le nomoro e fuoeng" e re re filoe palo e felletseng le palo m. Polelo ea bothata e kopa ho fumana palo e felletseng ea lihlahisoa tse tharo tse lekanang le sehlahisoa. Mohlala arr [] = {1,5,2,6,10,3} m = 30 3 Tlhaloso Tharo ...

Bala haholoanyane

Potso ea 96. Phapang e kholo lipakeng tsa li-index tsa pele le tsa hoqetela tsa ntho ka tatellano Ha re re o na le mefuta e mengata ea linomoro. Bothata "Phapang e kholo lipakeng tsa li-index tsa pele le tsa hoqetela tsa elemente e hlophisitsoeng" e kopa ho fumana phapang lipakeng tsa index ea pele le ea hoqetela ea nomoro ka 'ngoe e teng ka tatellano hore phapang e ba holimo ho tsohle. Mohlala ...

Bala haholoanyane

Potso ea 97. Fumana likarolo tse 'ne tse akaretsang boleng bo fanoeng (Hashmap) Bothata "Fumana likarolo tse 'ne tse akaretsang boleng bo fanoeng (Hashmap)" e re ha re re, o na le lenane le felletseng le nomoro e bitsoang kakaretso. Polelo ea bothata e botsa ho fumana hore na ho na le likarolo tse 'ne tse fumanehang ka har'a sehlopha se akaretsang boleng bo fuoeng "kakaretso". Haeba ke 'nete, sebetsa ...

Bala haholoanyane

Potso ea 98. Nako e telele ka ho fetesisa hoo phapang lipakeng tsa haufi ke e le 'ngoe Bothata "Nako e telele ho feta hore phapang pakeng tsa tse haufi ke" o re o fuoe lenane le le leng. Joale o hloka ho fumana bolelele ba nako e telele ho feta hore phapang ea likarolo tse haufi ke 1. Mohlala 1 2 3 4 7 5 9 4 6 Tlhaloso e le ...

Bala haholoanyane

Potso ea 99. Fumana li-triplets tsohle tse nang le zero sum Bothata "Fumana bohle ba bararo ka zero zero" e re o fuoa lethathamo le nang le linomoro tse nepahetseng le tse fosahetseng ka bobeli. Polelo ea bothata e kopa ho fumana karoloana ea boraro ka kakaretso e lekanang le 0. Mohlala arr [] = {0, -2,1,3,2, -1} (-2 -1 3) (-2 0 2) ( -1 0 1) Tlhaloso ...

Bala haholoanyane

Potso ea 100. Lekola hore na sehlopha se fanoeng se na le likarolo tse kopitsoang tse ka bang hole le tse ling Bothata "Hlahloba hore na sehlopha se fanoeng se na le likarolo tse ikopantseng tse ka bang hole le tse ling" se re re tlameha ho lekola likopi tse fumanehang ka har'a mefuta e sa lekanyetsoang ea k. Mona boleng ba k bo nyane ho feta sehlopha se fanoeng. Mehlala K = 3 arr [] = ...

Bala haholoanyane

Potso ea 101. Li kopane le sehlahisoa se fanoeng Bothata "Kopanya le sehlahisoa se fanoeng" e re o fuoe palo e felletseng le nomoro "x". Etsa qeto ea hore na sehlopha se na le para ea sehlahisoa se lekanang le 'x' se teng lenaneng le kentsoeng. Mohlala [2,30,12,5] x = 10 E, e na le Tlhaloso ea Pair ea Sehlahisoa Mona 2 ...

Bala haholoanyane

Potso ea 102. 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 103. Ntho ea pele e etsahalang makhetlo a k ka tatellano Re fane ka palo 'k' le palo e felletseng. Bothata "Ntho ea pele e hlahang makhetlo a k ka tatellano" e re ho fumana ntho ea pele sehlopheng se hlahang hantle makhetlo a k ka tatellano. Haeba ho se na letho lethathamong le hlahang makhetlo a k ...

Bala haholoanyane

Potso ea 104. Hatisa li-subarrara tsohle ka kakaretso ea 0 U fuoe lenane le felletseng, mosebetsi oa hau ke ho hatisa lintho tsohle tse ka bang teng ka karolelano ka kakaretso li lekana le 0. Kahoo re hloka ho Hatisa litepisi tsohle ka kakaretso ea 0. Mohlala arr [] = {-2, 4, -2, -1, 1, -3, 1, 5, 7, -11, -6} Sub-Array e fumanoe ho tsoa ho index ea 0 ...

Bala haholoanyane

Potso ea 105. 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 106. Nomoro ea bonyane ba foromo ho latela tatellano e fanoeng Bothata "Fomoro palo e nyane ho latela tatellano e fanoeng" e re o fuoe mohlala oa nna le oa D feela. Moelelo oa Ke emela ho eketseha le ho fokotseha re fuoang D. Setatemente sa bothata se kopa ho hatisa palo e nyane e khotsofatsang paterone e fanoeng. Re na le ...

Bala haholoanyane

Potso ea 107. Lipotso tse fapaneng bakeng sa ho latela nako e telele ka ho fetisisa ea bracket U fuoa tatellano ea li-brackets tse latelang, ka mantsoe a mang, u fuoa li-brackets tse kang '(' le ')' 'me u fuoa lethathamo la lipotso e le qalo le sebaka sa ho qetela. Bothata "Range Queries for Longest Correct Bracket" e botsa ho fumana bolelele bo phahameng ...

Bala haholoanyane

Potso ea 108. Sesebelisoa se seholo ka ho fetisisa se nang le palo e lekanang ea 0s le 1s U fuoa mefuta e mengata ea linomoro. Linomoro li na le 0 le 1 feela ka har'a lenane la ho kenya. Polelo ea bothata e kopa ho fumana sehlopha se seholo ka ho fetisisa se ka bang le palo e lekanang ea 0 le 1. Mohlala arr [] = {0,1,0,1,0,1,1,1} 0 ho isa ho 5 (kakaretso ea likarolo tse 6) Tlhaloso Ho tloha boemong ba tatellano ...

Bala haholoanyane

Potso ea 109. Likarolo tsa binary ka mor'a M mefuta e fapaneng ea ts'ebetso U fuoa mofuta oa binary, o nang le 0 qalong le palo ea lipotso. Polelo ea bothata e kopa ho fetola boleng (ho fetola 0s ho 1s le 1s ho 0s). Kamora hore lipotso tsa Q li etsoe, hatisa sephetho se latelang. Mohlala arr [] = {0, 0, 0, 0, 0} Toggle (2,4) ...

Bala haholoanyane

Potso ea 110. Kakaretso e sa lekanyetsoang ea lihlopha tse peli Polelo ea Bothata Bothata "Kakaretso e sa lekanyetsoang ea lihlopha tse peli" e re o fuoe likarolo tse peli e le litekanyetso tsa ho kenya joalo ka arrA [] le arrB [] ea boholo bo lekanang n. Hape, likarolo tsena ka bobeli li na le likarolo tse ikhethang ka bonngoe le likarolo tse ling tse tloaelehileng. Mosebetsi oa hau ke ho fumana kakaretso ...

Bala haholoanyane

Potso ea 111. Fumana lipara tsohle (a, b) ka tatellano hoo% b = k Polelo ea Bothata Bothata "Fumana lipara tsohle (a, b) ka tatellano hore% b = k" e re o fuoe palo ea linomoro le boleng bo felletseng bo bitsoang k. Polelo ea mathata e kopa ho fumana batho bao ka tsela eo x ...

Bala haholoanyane

Potso ea 112. Lipotso tse fapaneng tsa LCM Polelo ea Bothata Bothata "Range LCM Queries" bo re o na le lenane le kopaneng la lipotso. Potso ka 'ngoe e na le (ho le letšehali, ka ho le letona) e le bophara. Mosebetsi o fanoeng ke ho fumana LCM (ka ho le letšehali, ka ho le letona), ke hore, LCM ea nomoro eohle e tlang ka bongata ba ...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 114. Fumana hore na karoloana e nyane ea thaba kapa che Polelo ea Bothata Bothata "Fumana hore na subarray e ka sebopeho sa thaba kapa che" e re o fuoe lenane le felletseng. Polelo ea bothata e botsa ho fumana hore na mofuta o ka tlase o hlophisitsoeng pakeng tsa moeli o fanoeng o ka sebopeho sa thaba kapa ...

Bala haholoanyane

Potso ea 115. 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 116. 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 117. Bothata ba Merafo ea Khauta Polelo ea Bothata "Bothata ba Morafo oa Khauta" e re o fuoa gridi ea 2D e nang le lichelete tsa tšepe tse seng mpe tse behiloeng ka seleng ka 'ngoe ea grid e fanoeng. Qalong, motho ea sebetsang morafong o eme kholomong ea pele empa ha ho na thibelo moleng. A ka qala moleng ofe kapa ofe. ...

Bala haholoanyane

Potso ea 118. Ketsahalo e telele ka ho fetesisa e ntseng e eketseha Tse latelang ke sehlooho se seng se ratoang ke batho ba botsang lipotso. Ho ba koalla hohle ho ka ba fa menyetla e mecha ea ho leka likhetho. E ka lekola bokhoni ba mokhethoa ba ho nahana le ho sekaseka lintho le ho fumana tharollo e nepahetseng le e nepahetseng. Kajeno re rarolla bothata bo tlang ho ba teng ...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 121. Mofuta oa bubble o sebelisa mekotla e 'meli Polelo ea Bothata Bothata "Mofuta oa Bubble o sebelisa mekotla e 'meli" e re o filoe lethathamo la [] la boholo n. Theha mosebetsi oa ho hlophisa sehlopha se fanoeng ka [] u sebelisa mofuta oa mofuta oa bubble o nang le likarolo tse peli tsa data. Mohlala a [] = {15, 12, 44, 2, 5, ...

Bala haholoanyane

Potso ea 122. Hlopha lethathamo ho latela tatellano e hlalositsoeng ke sehlopha se seng Polelo ea Bothata U fuoa likarolo tse peli tsa palo e felletseng arr1 [] le arr2 []. Bothata "Hlophisa lethathamo ho latela tatellano e hlalositsoeng ke sehlopha se seng" e kopa ho hlophisa sehlopha sa pele ho latela sehlopha sa bobeli e le hore linomoro tsa sehlopha sa pele li tla hlophisoa ...

Bala haholoanyane

Potso ea 123. Kaho ea Ketsahalo e ntseng e eketseha ka ho fetisisa (N log N) Polelo ea Bothata O fuoa linomoro tse ngata. Bothata "Ho aha Ketsahalo e Eketsehang ka ho Fetisisa (N log N)" e kopa ho aha seemo se ntseng se eketseha ka ho fetisisa. Mohlala arr [] = {1, 4, 7, 2, 9, 6, 12, 3} 12, 9, 7, 4, 1 mme boholo ba ketsahalo ena e telele ka ho fetesisa ke ...

Bala haholoanyane

Potso ea 124. 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 125. Lokisa mefuta e mengata e le hore 'arr [j]' e be 'i' haeba 'arr [i]' ke 'j' Polelo ea Bothata Bothata ”Beakanya lintho tse ngata tse fapaneng hoo 'arr [j]' e bang 'i' haeba 'arr [i]' ke 'j'” e re u na le sehlopha sa "n" se nang le linomoro. Linomoro tse ka har'a sehlopha li fumaneha ho 0 ho isa ho n-1. Polelo ea bothata e kopa ho hlophisa bocha lenane la ...

Bala haholoanyane

Potso ea 126. Boholo ba Sehlahisoa sa Sehlahisoa Polelo ea Bothata Bothata ba "Maximum Product Subarray" bo re o fuoe lethathamo la linomoro tse nang le linomoro tse nepahetseng le tse fosahetseng. Polelo ea bothata e kopa ho fumana sehlahisoa se phahameng sa sehlopha se ka tlase. Mohlala arr [] = {2, -2, 3, 5} 15 Tlhaloso Lintlha tse lenaneng le ka tlase ...

Bala haholoanyane

Potso ea 127. Fetolela mefuta e mengata hore e be feshene ea Zig-Zag Polelo ea Bothata Bothata "Fetolela mefuta e mengata ho feshene ea Zig-Zag" e re o fuoe - ea linomoro. Polelo ea bothata e kopa ho hlophisa mefuta ka tsela ea zig-zag hore likarolo tsa sehlopha li shebahala joalo ka <b> c <d> e ...

Bala haholoanyane

Potso ea 128. Nete ​​ea pele e fosahetseng lifensetereng tsohle tsa boholo k Polelo ea Bothata Bothata "Nete ea pele e fosahetseng fensetereng e 'ngoe le e' ngoe ea boholo k" e re u fuoe lethathamo le nang le linomoro tse nepahetseng le tse fosahetseng, bakeng sa fensetere e 'ngoe le e' ngoe ea boholo k hatisa palo ea pele e fosahetseng fensetereng eo. Haeba ho se na linomoro tse fosahetseng fensetereng efe kapa efe, joale tlhahiso e tla hlaha.

Bala haholoanyane

Potso ea 129. Sebaka sa sele e haufinyane e nang le 1 ka popalo ea binary Polelo ea Bothata Bothata "Sebaka sa sele se haufi se nang le 1 ka popalo ea binary" se re o fuoa matrix ea binary (e nang le 0s le 1s feela) bonyane 1 e le ngoe. Fumana sebaka sa sele e haufinyane e nang le 1 matrix ea binary bakeng sa likarolo tsohle tsa ...

Bala haholoanyane

Potso ea 130. Foromo e nyane ea Foromo ho latela tatellano e fanoeng Polelo ea Bothata Bothata "Foromo e Nyane ea Fomu ho Tloha ho tatellano e fanoeng e re o fuoe khoele ea bolelele / boholo n e emelang sebopeho sa litlhaku 'I' ke hore ho eketsa le 'D' ke ho fokotseha feela. Hatisa palo e tlase bakeng sa paterone e fanoeng ka linomoro tse ikhethileng ho tloha ho 1-9. Mohlala - ...

Bala haholoanyane

Potso ea 131. Palo ea Liketsahalo tse telele ka ho fetesisa tse ntseng li eketseha Polelo ea Bothata Bothata "Palo ea Nako e Telele e Eketsehang" e re o fuoe sehlopha sa [] sa boholo n. Hatisa palo ea liketsahalo tse ntseng li eketseha ka ho fetisisa ho eona. Mohlala a [] = {1, 2, 5, 4, 7} 2 Tlhaloso: Liketsahalo tse telele ka ho fetisisa tse ntseng li eketseha li ka bonoa ho ...

Bala haholoanyane

Potso ea 132. 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 133. Ts'ebetsong ea Deque e sebelisa selikalikoe se chitja Polelo ea Bothata "Ts'ebetsong ea Deque o sebelisa selikalikoe" e kopa ho kenya tšebetsong mesebetsi e latelang ea Deque (Duely Ended Queue) u sebelisa selikalikoe, insertFront (x): kenya element x ka pele ho Deque insertRear (x): kenya element x ka morao ho Deque DeleFront (): hlakola ntho e tsoang ho ...

Bala haholoanyane

Potso ea 134. Hlophisa tatellano ka tatellano - e nyane haholo, kholo ka ho fetisisa, ea bobeli e nyane, ea bobeli e kholo Tlhaloso ea Bothata Ha re re u na le lenane le le leng. Bothata "hlophisa tatellano ka tatellano - e nyane haholo, kholo ka ho fetisisa, ea bobeli e nyane, ea bobeli e kholo, .." e kopa ho hlophisa mabotho ka tsela eo palo e nyane haholo e tlang pele ebe e latelang ea bobeli, ebe ea bobeli e nyane ebe ea bobeli ...

Bala haholoanyane

Potso ea 135. Lokisetsa lintho tse hlophisehileng joalo ka hore li behiloe hantle ho feta tse makatsang Tlhaloso ea Bothata Ha re re u na le lenane le le leng. Bothata "Hlophisa lintho tse hlophisehileng joalo ka hore li maemong a maholo ho feta a makatsang" o kopa ho hlophisa lintho tse ngata tse maemong a boemong bo tšoanang e lokela ho ba kholo ho feta ntho e tlileng pele ho eona. Arr [i-1] <= Arr [i], haeba boemo ba 'i' ...

Bala haholoanyane

Potso ea 136. Hlophisa linomoro tse fanoeng ho etsa palo e kholo ka ho fetisisa Polelo ea Bothata Ha re re u na le palo ea linomoro. Bothata "Hlophisa linomoro tse fuoeng ho etsa palo e kholo ka ho fetesisa" e kopa ho hlophisa mabotho ka tsela eo sehlahisoa se lokelang ho ba boleng bo holimo bo ka etsoang ka linomoro tsa sehlopha. Mohlala [34, 86, 87, ...

Bala haholoanyane

Potso ea 137. Tlosa likopi tse tsoang lenaneng le hlophisitsoeng Polelo ea Bothata "Tlosa mafahla a tsoang lihlopheng tse hlophiloeng" e re o fuoe boholo bo hlophisitsoeng ba boholo ba N. U hloka ho tlosa likarolo tse kopilitsoeng ho tse ngata. Hatisa lethathamo le nang le likarolo tse ikhethileng kamora ho tlosoa ha likarolo tsa lefahla. Mohlala a [] = {1, 1, 1, 1} {1} Tlhaloso: ...

Bala haholoanyane

Potso ea 138. Bala likaroloana tse potolohileng tse nang le likarolo tse fapaneng ka ho lekana le tatellano ea mantlha Polelo ea Bothata "Bala likaroloana tse ka tlase tse nang le likarolo tse fapaneng hantle le tsa mantlha" e re o fuoe lenane le le leng. Polelo ea bothata e kopa ho fumana palo e felletseng ea li-sub-arrays tse nang le likarolo tsohle tse fapaneng joalo ka ha li le teng ka tatellano ea mantlha. Mohlala arr [] = {2, 1, 3, 2, ...

Bala haholoanyane

Potso ea 139. Sehlahisoa sa mefuta e mengata ntle le ea hau Polelo ea Bothata "Sehlahisoa sa mefuta e mengata ntle le boithati", e re o filoe lethathamo le []. Hatisa mofuta o mong oa p [] oa boholo bo lekanang hoo boleng ba i'th index of array p bo lekanang le sehlahisoa sa likarolo tsohle tsa sehlopha sa mantlha ...

Bala haholoanyane

Potso ea 140. Ea pele e haelloa ke tšoaetso Polelo ea Bothata "Bothata ba pele bo sieo" bothata bo re o fuoa lethathamo le [] (hlophisitsoeng kapa le sa hlophisoang) la boholo n. Fumana nomoro ea pele e nepahetseng e haellang lethathamong lena. Mohlala a [] = {1, 3, -1, 8} 2 Tlhaloso: Haeba re hlopha tatellano eo re e fumanang {-1, ...

Bala haholoanyane

Potso ea 141. Khoutu ea Leetcode e Kopaneng Polelo ea Bothata Bothata ba "Contiguous Array Leetcode" bothata bo re o fuoe lethathamo [] la boholo n le na le 1 le 0's feela. Fumana karoloana e telele ka ho fetisisa eo palo ea 1 e lekanang le ea 0. Mohlala a [] = {1, 0, 1, 1, 1, ...

Bala haholoanyane

Potso ea 142. Linomoro tse nang le maqhubu a maholo ho feta kapa a lekana le k Polelo ea Bothata Bothata "Linomoro tse nang le maqhubu a maholo ho feta kapa a lekana le k" e re o fuoe mefuta e mengata ea boholo ba n le palo e kholo ea k. Linomoro tsohle tse ka hare ho eona ke linomoro tsa mantlha. Polelo ea bothata e kopa ho fumana linomoro tse hlahang ho ...

Bala haholoanyane

Potso ea 143. Fumana lipara ka kakaretso e fuoeng hoo likarolo tsa lipara li leng mela e fapaneng Polelo ea Bothata "Fumana lipara tse nang le chelete e fuoeng hoo likarolo tsa lipara li leng mela e fapaneng" bothata bo re o filoe palo ea linomoro le boleng bo bitsoang "kakaretso". Polelo ea mathata e kopa ho fumana lipara tsohle ka har'a matrix tse akaretsang ho tse fuoeng ...

Bala haholoanyane

Potso ea 144. Lintho tse tloaelehileng meleng eohle ea matrix e fanoeng Polelo ea Bothata "Mathata a tloaelehileng melaong eohle ea matrix e fanoeng" bothata bo bolela hore, o fuoa matrix ea M * N. Polelo ea bothata e kopa ho fumana lintlha tsohle tse tloaelehileng ka har'a matrix moleng ka mong oa matrix ka nako ea O (M * N). Mohlala arr [] = {{12, 1, 4, 5, ...

Bala haholoanyane

Potso ea 145. Bokella lintlha tse phahameng ho gridi u sebelisa litselana tse peli Polelo ea Bothata Re fuoa matrix ea boholo "nxm", 'me re hloka ho bokella lintlha tse ngata marang-rang re sebelisa litselana tse peli. Haeba re eme seleng ea i, j joale re na le likhetho tse tharo tsa ho ea seleng ea 1, j kapa i + 1, j-1 kapa i + 1, j + 1. Ke hore ...

Bala haholoanyane

Potso ea 146. Ha ho fanoa ka lihlopha tse sa hlophisoang tse peli li fumana lipara tsohle tseo kakaretso ea tsona e leng x Polelo ea Bothata Ha u fuoa likarolo tse peli tse sa hlophisoang, fumana lipara tsohle tseo palo ea tsona e leng x bothata e bolela hore u fuoe likarolo tse peli tsa linomoro tse sa hlophisoang le boleng bo bitsoang kakaretso. Polelo ea bothata e botsa ho fumana palo ea lipara le ho hatisa lipara tse eketsang ...

Bala haholoanyane

Potso ea 147. Hlopha lintho ka makhetlo Polelo ea Bothata O fuoa linomoro tse ngata, linomoro tse ling li phetoa ho eona. Polelo ea bothata e kopa ho hatisa palo ka bongata ka tatellano e fokotsehang ho latela maqhubu a bona a ho hlophisa likarolo ka makhetlo. Mohlala arr [] = {3,4,3,1,2,9,2,9,2,5} 2 2 2 3 3 9 9 ...

Bala haholoanyane

Potso ea 148. Fumana ntho ea pele e iphetang ka bongata ba linomoro Polelo ea Bothata Fumana ntho ea pele e pheta-phetoang ka tatellano ea li-integer bothata e re o fuoe palo e felletseng. E kopa ho fumana ntho ea pele e pheta-phetoang ho tsoa lenaneng ebe o hatisa palo eo. Mohlala arr [] = {2,6,9,3,1,9,1} 9 Tlhaloso: Lethathamong le fanoeng ho na le ...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 150. 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 151. Hlahloba boholo ba boholo ba n bo ka emela BST ea maemo kapa ha Polelo ea Bothata Ha u fuoa sehlopha se nang le likarolo, hlahloba boholo ba boholo ba n bo ka emela BST ea maemo kapa ha. Seo ke ho hlahloba hore na sefate sa patlo sa binary se hahiloeng ho sebelisoa li-element tsa n se ka emela BST ea maemo. Mehlala arr [] = {10, 8, 6, 9, ...

Bala haholoanyane

Potso ea 152. Fumana boholo ba karolelano ea bolelele ba k Polelo ea Bothata O fuoa linomoro tse ngata le palo k. Polelo ea bothata e kopa ho fumana boholo ba karolelano ea boholo ba k. Subarray ha se letho haese sehlopha se qapiloeng ho tsoa ho setene se kopaneng sa likarolo tsa sehlopha sa pele Mohlala arr [] = {1,3,12,34,76,10} [2, 4] Tlhaloso: Lethathamo le qala ...

Bala haholoanyane

Potso ea 153. Mabokose a hatisang Bothateng ba ho Atisa Chain ea Matrix Polelo ea Bothata Re hloka ho fumana tatellano ea ho atisoa ha matriki hore palo ea ts'ebetso e amehang katisong ea matriki kaofela e fokotsehe. Ebe re hloka ho hatisa odara ena ke hore, ha re hatisa masakaneng bothateng ba katiso ea liketane tsa matrix. Nahana hore o na le litlelase tse 3 A, B, ...

Bala haholoanyane

Potso ea 154. Fumana phapang e nyane lipakeng tsa likarolo tse peli Polelo ea Bothata O fuoa linomoro tse ngata. Polelo ea bothata e kopa ho fumana phapang e nyane lipakeng tsa likarolo tse peli tse fanoeng ka bongata. Mohlala arr [] = {11,1,6,8,20,13} 2 Tlhaloso: Bonyane phapang lipakeng tsa 11 le 13 ke 2. arr [] = {19,14,80,200,32,29} 3 Tlhaloso: Phapang e nyane lipakeng tsa 32 le 29 ...

Bala haholoanyane

Potso ea 155. Matrix e kholo ka ho fetisisa e likhutlo li 'ne eo kakaretso ea eona e leng 0 Polelo ea Bothata Fumana boholo bo boholo ba sub-matrix ka tatellano ea 2D eo palo ea eona e leng zero. Matrix ha se letho haese sehlopha sa 2D kahare ho sehlopha se fanoeng sa 2D. Kahoo, o na le matrix ea linomoro tse saennweng, o hloka ho bala kakaretso ea litlelase tse tlase mme o fumane matrix ka ...

Bala haholoanyane

Potso ea 156. Boholo ba khutlonne ea kakaretso ho matrix a 2D Polelo ea Bothata Fumana palo e kahodimodimo ya khutlonne ka matrix 2D ke hore ho fumana potlana e nang le palo e kahodimodimo. Matrix ha se letho haese sehlopha sa 2D kahare ho sehlopha se fanoeng sa 2D. Kahoo, o na le matrix ea linomoro tse saennweng, o hloka ho bala kakaretso ea litlelase tse tlase le ...

Bala haholoanyane

Potso ea 157. Palo e kahodimodimo ea Kakaretso ea Keketseho Polelo ea Bothata O fuoa linomoro tse ngata. Mosebetsi oa hau ke ho fumana palo e kaholimo ho palo ka har'a sehlopha ka tsela eo linomoro tse tla latela li lokelang ho odaroa ka mokhoa o hlophisitsoeng ka tatellano e ntseng e eketseha. Ho latela ha ho letho haese tatellano eo re ...

Bala haholoanyane

Potso ea 158. Subarray e kholo ka ho fetesisa ea Sum Polelo ea Bothata O fuoa linomoro tse ngata. Polelo ea bothata e kopa ho fumana karolelano e kholo ka ho fetisisa ea chelete. Sena ha se bolele letho haese ho fumana karoloana e nyane (e tsoelang pele) e nang le kakaretso e kholo ka ho fetisisa har'a lithaelese tse ling tsohle tse lenaneng le fanoeng. Mohlala arr [] = {1, -3, 4, ...

Bala haholoanyane

Potso ea 159. Katiso ya Chain ya Matrix Mathateng a mathathamo a II a katiso ea matrix, re fane ka litekanyo tsa matriki, fumana tatellano ea katiso ea bona joalo ka hore palo ea ts'ebetso e amehang katekisong ea matriki kaofela e fokotsehe. Nahana hore o na le litriki tsa 3 A, B, C tsa boholo ba axb, bx ...

Bala haholoanyane

Potso ea 160. 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 161. Nomoro e le 'ngoe Ha ho fanoa ka bongata ba [] boholo ba n. Lintho tsohle tse ka har'a sehlopha li teng habeli ntle le 1. Batla element e hlahang hang feela kapa ka mantsoe a mang re re fumana palo e le 'ngoe. Keletso ea Mohlala: a [] = {1, 3, 5, 5, 2, 1, 3} ...

Bala haholoanyane

Potso ea 162. Mokhoa o tlase oa Leetcode Bothateng ba Subset Leetcode re fane ka li-integer, li-num, ho hatisa li-subsets tsohle (sete ea motlakase). Tlhokomeliso: Tharollo e behiloeng ha ea lokela ho ba le likopi tse tlase. Sehlopha A ke setlhopha sa mofuta oa B haeba ho ka fumanoa ho B ka ho hlakola tse ling (mohlomong, zero ...

Bala haholoanyane

Potso ea 163. Phunya Lethathamo E fuoe sehlopha kapa sete e nang le likarolo tsa n. Mona likarolo li ikhethile kapa ha ho pheta-phetoe. Phunya palo (kapa sete) ea linomoro ntle le likopi. Mohlala // Init sehlopha se nang le sete 2, 4, 3 le 1. int [] nums = {2, 4, 3, 1}; Phunya ntho = ...

Bala haholoanyane

Potso ea 164. 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 165. Ho Arola Lethathamo ka Bobeli ka Bobeli ho Khetholloa ke K Ho arola lihlopha ka bobeli ka kakaretso e arohanngoang ke K ke bothata bo botsoang lipuisanong le li-tweaks tse fapaneng khafetsa. Ba ntsebang ba tseba tloaelo ea ka ea ho fetola mathata ana ho ba lipale. Sehloohong sena ha re shebeng bothata bona. Boemo ba ho utloisisa ...

Bala haholoanyane

Potso ea 166. Bala likarolo tse fapaneng ka fensetere e 'ngoe le e' ngoe ea boholo K Subsets ke ntho eo esale re sebetsana le eona nakoana joale. Ketsahalong ea ho qetela, re koahetse palo ea li-subsets tseo re ka li etsang ka lipalo tse fapaneng. Lekhetlong lena re bala likarolo tse ikhethileng fensetereng e 'ngoe le e' ngoe ea boholo K. Karolo ea 1 Mabapi le bothata. E filoe sehlopha se sa hlophisoang ...

Bala haholoanyane

Potso ea 167. Fumana likarolo tse tharo ho tsoa ho mefuta e meraro e fapaneng e fapaneng hoo e ka bang + b + c = kakaretso Sum tse tharo ke bothata bo ratoang ke batho ba botsang lipotso. Ke bothata boo ke ileng ka bo botsoa ka seqo nakong ea tlhahlobo ea Amazon. Kahoo, ntle le ho senya nako ho ea bothateng. Sehlopha se nang le linomoro tse nepahetseng le tse fosahetseng. Linomoro tse tharo tse ka fihlang ho zero / li ka fetoloa, ...

Bala haholoanyane

Potso ea 168. Puputso ea Lentsoe Patlo ea mantsoe ke ntho e kang malepa a ho fumana mantsoe ka nako e 'ngoe bophelong ba rona. Kajeno ke tlisa tafoleng poleloana e fetotsoeng. Babali ba ka ba tlameha ho makala hore na ke bua ka eng. Ntle le ho senya nako, a re fihleng polelong ea mathata Re ka ...

Bala haholoanyane

Potso ea 169. K Empty slots K libaka tse se nang letho li hlahisa bothata ba molemi, ho leka ho kha lipalesa tse lumellanang le boemo ba rona. Mohlokomeli oa serapa sa rona o na le tšimo ea li-N-slots. Mong serapa o lemme lipalesa ho e 'ngoe le e' ngoe ea marulelo. Palesa e 'ngoe le e' ngoe e tla thunya ka letsatsi le ikhethang. Hape, re lemme lipalesa tse lulang li le setala. ...

Bala haholoanyane

Potso ea 170. Bala lipara tseo lihlahisoa tsa tsona li leng teng ka tatellano Ka lipalo tse peli tseo lihlahisoa tsa tsona li nang le mathata a mangata re faneng ka tsona, bala lihlopha tse peli tse ikhethang tseo boleng ba lihlahisoa li leng teng ka har'a sehlopha. Kenyelletso ea Mohlala A [] = {2, 5, 6, 3, 15} Palo ea palo ea lipara tse ikhethileng tseo sehlahisoa sa tsona se fumanehang ka har'a sehlopha ke: 2 Pairs are: (2, ...

Bala haholoanyane

Potso ea 171. Hatisa Lintho Tsohle Tse Ikhethileng tsa Lenane le Felletseng le Fanoeng Ha u fuoa palo e felletseng, hatisa likarolo tsohle tse fapaneng ka har'a sehlopha. Sehlopha se fanoeng se ka ba le likopi mme sehlahisoa se lokela ho hatisa ntho e ngoe le e ngoe hang feela. Sehlopha se fanoeng ha sea hlophisoa. Keketso ea Mohlala: nums [] = {12, 10, 9, 45, 2, 10, 10, 45} Sephetho: 12, 10, 9, 45, 2 Mokhoa ...

Bala haholoanyane

Potso ea 172. Pair ea Melao e Ntle e Nepahetseng Lenaneng Ka lipalo tse ntle tse mpe bothateng bo fapaneng re fane ka lenane A la linomoro tse fapaneng, hatisa lipara tsohle tse nang le boleng bo nepahetseng le boleng bo fosahetseng ba palo e teng ka har'a sehlopha. Re hloka ho hatisa lipara ho latela tatellano ea tsona. Banyalani bao ...

Bala haholoanyane

Potso ea 173. Bala lipara tse fanoeng ka kakaretso Ha u fuoa palo e kholo ea boholo ba n, le palo e kholo ea 'K', u hloka ho bala palo ea lipara (ha ho hlokahale hore li khetholle) tse teng ka har'a sehlopha seo kakaretso ea sona e lekanang le 'K'. Ho kenya mohlala: Arr = {1, 5, 7, 1} K = 6 Output: 2 Brute force solution for Count Pairs With Given Sum Main idea ...

Bala haholoanyane

Potso ea 174. Kenya Tlosa GetRandom Ho Kenyeletsa Tlosa bothata ba GetRandom re hloka ho rala sebopeho sa data se ts'ehetsang lits'ebetso tsohle tse latelang ka nako ea O (1). kenya (val): E kenya ntho val ho sete haeba e se e ntse e le teng. tlosa (val): E tlosa ntho ea boleng ho sete haeba e le teng. getRandom: E khutlisa ntho e sa reroang ho tloha sethaleng sa hona joale ...

Bala haholoanyane

Potso ea 175. 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 176. 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 177. Boholo ba Sehlahisoa sa Sehlahisoa Bothateng bo boholo ba lihlahisoa tse nyane tsa lihlahisoa, re fane ka palo e felletseng ea linomoro, fumana sehlopha se kopaneng se nang le atleast element e le 'ngoe e nang le sehlahisoa se seholo ka ho fetisisa. Mohlala Arr = [0, -1, 0, 1, 2, -3] Boholo ba sehlahisoa = 2 Arr = [- 1, -1, -1] Boholo ba sehlahisoa = -1 Arr = [0, -1, 0, - 2, 0] ...

Bala haholoanyane

Potso ea 178. Fumana Boholo ba Bonyane bakeng sa Boholo ba Window e 'ngoe le e' ngoe ka tatellano e fanoeng Ha ho fanoa ka bongata ba [] boholo ba n. Bakeng sa boholo bo bong le bo bong ba fensetere bo fapaneng ho tloha ho 1 ho isa ho n ka ho hatisoa ka bongata kapa ho fumana bonyane bo fokolang bakeng sa boholo ba fensetere e ngoe le e ngoe ka tatellano e fanoeng Keletso ea Mohlala: a [] = {10, 20, 30, 50, 10, 70, 30} Sephetho: 70 30 20 ...

Bala haholoanyane

Potso ea 179. Bonyane ba Tlatsetso ea Boholo ba Boholo Ha u fuoa linomoro tse ngata tsa palo e nepahetseng le kakaretso, fumana boholo bo tlase ba palo e nyane ea linomoro tseo palo ea tsona e lekanang kapa e fetang s (boleng bo fuoeng). Keletso ea Mohlala: nums [] = {2, 3, 1, 2, 4, 3} s = 7 Sephetho: 2 {Subarray [4, ...

Bala haholoanyane

Potso ea 180. 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 181. Boholo ba Sehlahisoa sa Sehlahisoa Ha u fuoa mefuta e mengata ea linomoro, fumana sehlahisoa se phahameng ka ho fetisisa se fumanoeng ho tsoa ho karolo e nyane ea sehlopha se fanoeng. Mehlala Keketso ea ho kenya [] = {-2, -3, 0, -2, -40} Tlhahiso ea 80 Input arr [] = {5, 10, 6, -2, 1} Khumo ea 300 Input arr [] = {-1 , -4, -10, 0, 70} Khumo 70 ...

Bala haholoanyane

Potso ea 182. Beha Matrix a Matrix Mathateng a li-matrix zero set, re fane ka (n X m) matrix, haeba elemente e le 0, seta mola oa eona le kholomo ea 0. Mehlala Keketso: {[1, 1, 1] [1, 0, 1] [1, 1, 1]} Sephetho: {[1, 0, 1] [0, 0, 0] [1, 0, 1] ...

Bala haholoanyane

Potso ea 183. 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 184. Fumana Nomoro ea Mafahla Ha ho fanoa ka li-num tse ngata tse nang le likarolo tsa (n + 1) mme ntho e ngoe le e ngoe e pakeng tsa 1 ho isa ho n. Haeba ho na le elemente e le 'ngoe feela e kopilitsoeng, fumana linomoro tse kopilitsoeng. Mehlala Input: nums = {1, 3, 4, 2, 2} Output: 2 Input: nums = {3, 1, 3, 4, 2} Output: 3 Naive ...

Bala haholoanyane

Potso ea 185. Sampling ea Letamo Reservoir Sampling ke mokhoa oa ho khetha lintho tsa polokelo ea metsi ka mokhoa o ikhethileng lenaneng le fanoeng la lintho tsa n, moo n e kholo haholo. Mohlala, lethathamo la lipatlisiso ho Google, YouTube jj. Naive Approach for Reservoir Sampling Iketsetse pokello ea pokello ea boholo ba k, khetha lintho ka tatellano lenaneng le fanoeng. ...

Bala haholoanyane

Potso ea 186. 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 187. Bonyane ba Tsela Sum Bothateng bo tlase ba kakaretso ea tsela, re file "a × b" matrix e nang le linomoro tse seng mpe. Mosebetsi oa hau ke ho fumana tsela ho tloha kaholimo ho le letšehali ho ea tlase tlase e fokotsang kakaretso e nang le linomoro tsohle tse tlang tseleng eo u e fumaneng. Tlhokomeliso: U ka tsamaisa feela ...

Bala haholoanyane

Potso ea 188. Mokhoa oa ho kenya ts'ebetsong hantle mekotla e le ngoe feela? Rala le ho kenya tšebetsong sebopeho se secha sa data se kenang ts'ebetsong ka mekhahlelo e le 'ngoe. Sebopeho sa data se secha se tlameha ho ts'ehetsa ts'ebetso tsena tse peli - Push (element, stack_number): e sutumelletsang element ka palo e fuoeng ea spaka. pop (stack_number): e hlahisang ntho e holimo ho e fanoeng ...

Bala haholoanyane

Potso ea 189. Hatisa lipotso tse latelang tse kholo tsa Q Bothateng ba lipotso tse hatisitsoeng tse latelang tse hatisitsoeng re hatisitse boholo ba [] boholo ba linomoro tse nang le linomoro le mofuta o mong oa q [] oa boholo ba limithara tse emelang lipotso. Potso ka 'ngoe e emela index ka tatellano []. Bakeng sa potso e ngoe le e ngoe, ke hatisa nomoro ho tsoa lenaneng ...

Bala haholoanyane

Potso ea 190. Lekola hore na Lethathamo le ka hlophisoa hantle Ha re hlahloba hore na bothata bo na le mathata a mangata hakae, re fane ka boholo ba [] ea boholo ba n e nang le likarolo ho tloha 1 ho isa ho n ka tatellano. Hlophisa lethathamo la ho nyoloha ka tatellano o sebelisa pokello ea nakoana kamora ts'ebetso ena e 'meli feela - Tlosa karolo qalong ...

Bala haholoanyane

Potso ea 191. Fumana linomoro tse holimo tsa K (kapa tse atisang ho ba hangata) ho phalla Ho fumana linomoro tse holimo tsa k (kapa khafetsa) bothateng ba molapo, re fane ka lenane le felletseng le nang le linomoro tse ling. Polelo ea bothata e re o tlameha ho nka ntho ho tsoa lenaneng, mme o ka ba le linomoro tse ngata tsa k ka holimo. Re hloka ...

Bala haholoanyane

Potso ea 192. K Empty slots LeetCode K Empty Slots ke bothata bo tummeng haholo ho LeetCode. Polelo ea bothata e joalo- Serapa se entsoe ka li-slots tse nang le lipalesa ka 'ngoe. Lipalesa tsohle ha li na lipalesa qalong. Ho fanoe ka mefuta e mengata ea lipalesa le manane a k. Ha re nahana hore ke bolela ho tloha ho 0, i + 1'th ...

Bala haholoanyane

Potso ea 193. 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 194. Theknoloji ea Sliding Window Pele o tsoela pele le mokhoa oa ho fereha oa fensetere ke eng? Seo e se etsang le kamoo e se etsang ka teng se re lumella ho fumana pono ea mohopolo ona ka bothata bo nyane Kaha re na le palo e felletseng ea linomoro, re na le mosebetsi oa ho fumana chelete e tlase ho bohle ...

Bala haholoanyane

Potso ea 195. Ho fumana karolo e haufi ea K Ha re fumana K bothata ba ntlha e haufi re fane ka mofuta o hlophisitsoeng le boleng x. Bothata ke ho fumana palo ea K ea likarolo tse haufi haholo le x ka bongata bo fanoeng. Ho fanoe ka tatellano arr [] = {12, 16, 22, 30, 35, 39, 42,45, 48, 50, 53, 55, 56} le x ...

Bala haholoanyane

Potso ea 196. 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 197. Postfix ho Prefix Conversion Bothateng bona, re fane ka khoele e bolelang polelo ea postfix. Re tlameha ho etsa postfix ho fetolela sehlongwapele. Sengoloa sa Prefix Ho notation ena, re ngola li-opereishene kamora mosebelisi. E boetse e tsejoa e le Sepheo sa Poland. Mohlala: + AB ke sehlongwapele. Tsebiso ea Postfix Ho ...

Bala haholoanyane

Potso ea 198. 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 199. Sebaka sa Max Island Tlhaloso ea Bothata: Ha ho fanoa ka matrix a 2D, matrix e na le 0 feela (e emelang metsi) le 1 (e emelang mobu) joalo ka litlatsetso. Sehlekehleke se matrix se theoa ka ho hlopha lihlopha tsohle tse haufinyane tsa 1 tse hokahantsoeng ka 4 (ka mokhoa o otlolohileng le o otlolohileng). Fumana sebaka se phahameng sa sehlekehleke ka har'a matrix. Nka hore likarolo tsohle tse 'ne tsa ...

Bala haholoanyane

Potso ea 200. 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 201. Litsela Tse Ikhethileng Ho fanoa ka gridi ea mxn 2D 'me u eme kaholimo ho sele le ka ho le letšehali ho grid. ke hore sele e fumanehang ho (1,1). Fumana palo ea litsela tse ikhethileng tse ka nkuoang ho fihlela sele e fumanehang ho (m, n) ho tloha seleng e fumanehang ho (1,1) ...

Bala haholoanyane

Potso ea 202. 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 203. Bolelele ba Ketsahalo e telele ka ho fetisisa ea Fibonacci Ha u fuoa mefuta e mengata e metle ea linomoro tse nepahetseng, fumana bolelele ba nako e telele ka ho fetisisa ea fibonacci. Lethathamo la likarolo tsa n ke fibonacci joaloka haeba, n> = 3 xi = x (i - 2) + x (i -1), moo xi e leng nako ea tatellano mme i> = 2 Mehlala Input arr []. ..

Bala haholoanyane

Potso ea 204. 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 205. 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 206. 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 207. K-th Element e nyane haholo ho Matrix e hlophisitsoeng Ho K-th Element e nyane haholo bothateng bo hlophisitsoeng ba Matrix, re fane ka matrix a nxn, moo mola o mong le o mong le kholomo e hlophisitsoeng ka tatellano e sa fokotseheng. Fumana karoloana e nyane ka ho fetisisa ea mofuta oa 2D. Ho kenya mohlala 1: k = 3 le matrix = 11, 21, 31, 41 ...

Bala haholoanyane

Potso ea 208. 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 209. Nomoro e sieo Bothateng ba Nomoro e Haellang re fane ka boholo ba boholo ba N bo nang le nomoro ho tloha ho 0 ho isa ho N. Litekanyetso tsohle tsa sehlopha li ikhethile. Re hloka ho fumana palo e sieo e seng teng ka bongata mme palo eo e pakeng tsa 0 le N. Mona ...

Bala haholoanyane

Potso ea 210. Kopanya Array Array Ha re kopanya bothata bo hlophisitsoeng re hlophisitse likarolo tse peli tse hlophiloeng ka tatellano e ntseng e eketseha. Ha re kenya letsoho pele, re fane ka palo e qalileng ho ar1 le array2. Linomoro tsena tse peli ke N le M. Boholo ba array1 bo lekana le kakaretso ea N le M. Ka tatellano ea 1 pele ...

Bala haholoanyane

Potso ea 211. Karohano e lekanang le Subset Sum Karolo ea Equal Subset Sum ke bothata moo re faneng ka linomoro tse ngata tse ntle. Re tlameha ho fumana hore na re ka e arola likaroloana tse peli molemong oa hore kakaretso ea likarolo li-sets ka bobeli e ts'oane. Mona ha ho hlokahale hore palo ea ...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 213. Potoloha ka tatellano Ho potoloha ke bothata moo re faneng ka boholo ba boholo ba N. Re tlameha ho potoloha ka tatellano ka tsela e nepahetseng. Karolo e 'ngoe le e' ngoe e fetoha ka boemo bo le bong ka lehlakoreng le letona le la ho qetela la sehlopha se fihla boemong ba pele. Kahoo, re fane ka boleng K ...

Bala haholoanyane

Potso ea 214. 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 215. Katiso ea Chain ea Matrix u sebelisa Dynamic Programming Katleho ea Matrix ke mokhoa oo re fumanang mokhoa o motle oa ho atisa matrices ao re a filoeng. Kaofela rea ​​tseba hore katiso ea matrix e hokahane (A * B = B * A) ka tlhaho. Kahoo, re na le litaelo tse ngata tseo re batlang ho li atisa. Ebile, ka algorithm ena, ...

Bala haholoanyane

Potso ea 216. 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 217. 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 218. Hlophisa Mofuta Mofuta oa qubu ke mokhoa oa ho bapisa o ipapisang o ipapisitseng le sebopeho sa data sa Binary Heap. HeapSort e ts'oana le mofuta oa khetho moo re fumanang karolo e kholo ebe re beha karolo eo qetellong. Re pheta ts'ebetso e ts'oanang bakeng sa likarolo tse setseng. E filoe e sa hlophisoang ...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 220. Katiso ea Materiki a mabeli Polelo ea Bothata Bothateng ba "Ho Atisoa ha Matrice a Mabeli" re file matric tse peli. Re tlameha ho atisa matrices ana le ho hatisa sephetho kapa matrix a hoqetela. Mona, boemo bo hlokahalang le bo lekaneng ke palo ea likholomo ho A e lokelang ho lekana le palo ea mela ea matrix ...

Bala haholoanyane

Potso ea 221. Palo e tlase ea Merge Operations ho etsa Array Palindrome Polelo ea Bothata Ho "Minimum palo ea Merge Operations ho etsa Array Palindrome" bothata re fane ka letoto "a []". Fumana palo e tlase ea merge_operations e hlokahalang ho etsa palindrome e fapaneng. Tlhokomeliso, palindrome ke lentsoe, poleloana kapa tatellano e balang morao ka ho ts'oana le ho ea pele. ...

Bala haholoanyane

Potso ea 222. Foromo e nyane ea Foromo ho latela tatellano e fanoeng ea li-D le tsa ka Polelo ea Bothata Bothateng ba "Fomoro e Nyane ea Foromo ho tloha tatelanong ea tatellano ea D's le Nna", re fane ka paterone e nang le li-D le li-D feela. Ke bakeng sa ho eketseha le D bakeng sa ho fokotseha. Ngola lenaneo ho hatisa palo e tlase ho latela paterone eo. Lidijiti ho tloha ho 1-9 le lipalo ha li khone ho pheta. Mofuta oa Keketso ...

Bala haholoanyane

Potso ea 223. Fumana Subarray ea bolelele bo fanoeng ka Bonyane Karolelano Polelo ea Bothata Bothateng ba "Fumana Subarray ea bolelele bo fanoeng ka Bonyane Karolelano" re fane ka lethathamo le palo e kholo ea X. Ngola lenaneo ho fumana subarray ea bolelele X ka bonyane / bonyane karolelano. E hatisa li-index tsa ho qala le ho phethela tsa subarray e nang le bonyane ...

Bala haholoanyane

Potso ea 224. Fumana Zeros hore li Flipped e le hore Palo ea tse latellanang 1's e ntlafatsoe Polelo ea Bothata Ho "Fumana Zeros hore li Flipped e le hore Palo ea tse latellanang tsa 1 e ntlafalitsoe" re fane ka lenane la li-binary le nomoro ea x e bolelang che. ea zeros e lokelang ho phetoa. Ngola lenaneo ho fumana li-zero tse hlokang ho phetoa joalo ...

Bala haholoanyane

Potso ea 225. Kopanya K Li hlophisitsoe ka tatellano le Phatlalatso e hlophisitsoeng e hlophisitsoeng Polelo ea Bothata Bothateng ba "Merge K Sorted Arrays le Output Sorted Output" re fane ka k hlophisoa ka tatellano ea boholo bo fapaneng. Ngola lenaneo ho kopanya likarolo tseo mme u hatise lenane la ho qetela le hlophisitsoeng e le sehlahisoa. Fomate ea ho kenya Mohala oa pele o nang le palo e kholo n. Melao e latelang e nang le ...

Bala haholoanyane

Potso ea 226. Fumana bonyane ba Element ka tatellano e hlophisitsoeng le e potolohileng Polelo ea Bothata Bothateng ba "Fumana Bonyane ba Element ho Lethathamo le Hlophisitsoeng" re fane ka lethathamo le hlophisitsoeng []. Sehlopha sena se potoloha ka nako e sa tsejoeng, fumana bonyane ba karolo ea sehlopha sena. Fomate ea ho kenya Inline ea pele ebile e le 'ngoe feela e nang le boleng bo boholo ba n. ...

Bala haholoanyane

Potso ea 227. Hlopha Elements ka Frequency II Polelo ea Bothata Bothateng ba "Hlopha Lintho ka Makhetlo a II" re fane ka letoto le []. Hlophisa lethathamo ho latela makhetlo a likarolo moo karolo e phahameng ea maqhubu e tlang pele ho tse ling. Fomate ea ho kenya: Mohala oa pele le o le mong feela o nang le n Mokha oa bobeli o nang le ...

Bala haholoanyane

Potso ea 228. Theko ea thekiso ho reka ho eketsa phaello Polelo ea Bothata Bothateng ba "Buy Buy Sell to Maximize Profit" re fane ka lethathamo le nang le theko ea setoko ka letsatsi ka leng, fumana phaello e holimo eo u ka e etsang ka ho reka le ho rekisa matsatsing ao. Mona, re ka reka le ho rekisa makhetlo a mangata empa feela kamora ho rekisa ...

Bala haholoanyane

Potso ea 229. 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 230. 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 231. Bothata ba ho Hlopha Pancake Polelo ea Bothata "Pancake Sorting Bothata" e ipapisitse le ho hlopha li-pancake. Ha re fuoa sehlopha se sa hlophisoang, re hloka ho ngola lenaneo le sebelisang ts'ebetso ea ho phethela feela. Flip ke ts'ebetso e khutlisetsang morao. Fomate ea ho kenya Mohala oa pele o nang le palo e kholo ea N. Mohala oa bobeli o nang le N e arohaneng le sebaka ...

Bala haholoanyane

Potso ea 232. Ho hlophisa Pancake Polelo ea Bothata Bothateng ba "Pancake Sorting" re file mefuta e mengata ea linomoro A []. Hlophisa sehlopha ka ho etsa letoto la li-pancake flips. Ho e 'ngoe ea li-pancake re etsa mehato e latelang: Khetha palo e kholo ea k moo 1 <= k <= arr.length. Khutlisa li-arr-arr arr [0… k-1] (0-indexed). Keletso ...

Bala haholoanyane

Potso ea 233. 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 234. Ts'ebetso ea Iterative ea Mofuta o Potlakileng Polelo ea Bothata Bothateng ba "Ts'ebetsong ea Ts'ebetso ea Mofuta o Potlakileng", re fane ka letoto le []. Re tlameha ho hlophisa lethathamo re sebelisa mofuta o potlakileng. Mona, mofuta o potlakileng ha o sebelisoe khafetsa, o etsoa ka mokhoa oa ho pheta-pheta. Fomate ea ho kenya Mohala oa pele o nang le palo e kholo n. Mohala oa bobeli o nang le ...

Bala haholoanyane

Potso ea 235. Phunya lenane le fanoeng Polelo ea Bothata Bothateng ba "Shuffle a Array Array" re fane ka palo ea linomoro. Ngola lenaneo le hlakolang sehlopha se fanoeng. Ka mantsoe a mang, e tla hlakola likarolo tse fapaneng ka tatellano. Fomate ea ho kenya Mohala oa pele o nang le palo e kholo n. Mohala oa bobeli o nang le tlhahiso e kholo e arohaneng ea sebaka ...

Bala haholoanyane

Potso ea 236. Fumana Row ka palo e kahodimodimo ea 1 Polelo ea Bothata Bothateng ba "Fumana Row ka Boholo ba Palo ea 1" re fane ka matrix (sehlopha sa 2D) se nang le linomoro tsa binary ka mola o mong le o mong o hlophisitsoeng. Fumana mola o nang le palo e phahameng ea li 1. Fomate ea ho Kena Mohala oa pele o nang le litekanyetso tse peli tsa linomoro n, m. E latelang, n mela ...

Bala haholoanyane

Potso ea 237. Ho hlophisa mofuta o hlophisitsoeng oa K Polelo ea Bothata Bothateng ba "Ho hlophisa K Arged Array" re fane ka mefuta e mengata ea likarolo, moo karolo e ngoe le e ngoe e leng k haholo hole le boemo ba eona. Rala algorithm e fapaneng ka nako ea O (n logi k). Fomate ea ho Kena Mohala oa pele o nang le litekanyetso tse peli tse lekanang N ...

Bala haholoanyane

Potso ea 238. Boholo ba Sehlahisoa sa Sehlahisoa II Polelo ea Bothata Bothateng ba "Maximum Product Subarray II" re fane ka lethathamo le nang le linomoro tse nepahetseng, tse fosahetseng, le linotši. Re hloka ho fumana sehlahisoa se phahameng sa subarray. Fomate ea ho kenya Mohala oa pele o nang le palo e kholo ea N. Mohala oa bobeli o nang le linomoro tse arohaneng tsa sebaka sa N. Sebopeho sa Khumo Ke sona feela ...

Bala haholoanyane

Potso ea 239. 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 240. 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 241. 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 242. Keketseho ea Ts'ebetso ea Bolelele ba Boraro le Sehlahisoa se Boholo Polelo ea Bothata Bothateng ba "Keketseho e latelang ea bolelele ba boraro ka sehlahisoa se phahameng", re fane ka lethathamo la linomoro tse nepahetseng. Fumana tatellano ea bolelele ba 3 ka sehlahisoa se phahameng. Tse latelang li lokela ho eketseha. Fomate ea ho kenya: Mohala oa pele le o le mong feela o nang le palo e kholo ea N e bonts'a boholo ...

Bala haholoanyane

Potso ea 243. 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 244. Fumana Peak Element ho tsoa Lenaneng Polelo ea Bothata Bothateng ba "Fumana Peak Element ho tsoa ho Lenane" re fane ka palo ea linomoro. Fumana ntlha e phahameng. Ka bongata, elemente ke ntlha ea tlhoro, haeba elemente e le kholo ho feta baahelani ka bobeli. Bakeng sa likarolo tsa sekhutlo, re ka nahana ka eona feela ...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 246. 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 247. Tug ea Ntoa Polelo ea Bothata Ha re hula bothata, re fane ka linomoro tse ngata, re arole likarolo tse peli tsa boholo ba n / 2 size e le hore phapang ea kakaretso ea li-subsets tse peli e be bonyane kamoo ho ka khonehang. Haeba n esita le boholo bo bong le bo bong ba subset ke n / 2. Haeba ...

Bala haholoanyane

Potso ea 248. Leeto la Pele la Potoloho ea ho Etela Li-Petroli Tsohle Leetong la pele la selikalikoe ho etela mathata ohle a peterole polelo e joalo ka hore ho na le selikalikoe se nang le lipompo tsa peterole selikalikoe. Pompo e 'ngoe le e' ngoe ea peterole e na le lintlha tse peli. Boleng ba pele ke palo ea pompo ea peterole 'me ea bobeli ke ...

Bala haholoanyane

Potso ea 249. Bala Likhutlo Tse ka Khonehang Polelo ea Bothata Ha re bala mathata a likhutlo-tharo a 'maloa re fane ka linomoro tse ngata tse nepahetseng. Fumana palo ea likhutlo-tharo e ka thehoang u sebelisa likarolo tse tharo tse fapaneng tsa sehlopha joalo ka mahlakore a triangolo. Tlhokomeliso: Boemo ba khutlo-tharo ke kakaretso ea mahlakore a mabeli ...

Bala haholoanyane

Potso ea 250. Palo e kahodimodimo ea selikalikoe se chitja Polelo ea Bothata Bothateng bo boholo ba selikalikoe sa selikalikoe, re fane ka palo ea linomoro tse hlophisitsoeng ka selikalikoe, re fumane palo e kahodimodimo ea linomoro tse latellanang ka har'a selikalikoe. Mohlala Input arr [] = {13, -17, 11, 9, -4, 12, -1} Tlhaloso ea 40 Tlhaloso Mona, kakaretso = 11 + ...

Bala haholoanyane

Potso ea 251. 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 252. 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 253. Bothata ba Botumo Polelo ea Bothata Bothateng ba batho ba tummeng ho na le kamore ea batho ba N, Fumana motho ea tummeng. Maemo a Motho ea Tummeng ke- Haeba A ke Motho ea Tummeng joale mang le mang ka phapusing o lokela ho tseba A. A ha ea lokela ho tseba mang kapa mang ka phapusing. Re hloka ho fumana motho ea khotsofatsang maemo ana. ...

Bala haholoanyane

Potso ea 254. Fumana sephetho sa boholo ba 3 Polelo ea Bothata Lethathamong le fuoeng la linomoro tse sa hlophisoang. Re hloka ho fumana tatellano e hlophisitsoeng ea boholo ba 3. A likarolo tse tharo e be tse hlophiloeng [i], array [j], array [k] ebe, array [i] <array [j] <array [k] for i <j < k. Haeba ho na le makhetlo a mararo a fumanoang ka har'a sehlopha, hatisa efe kapa efe ...

Bala haholoanyane

Potso ea 255. 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 256. 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 257. Bala Mehato e Monyane ea ho Fumana Lethathamo le fanoeng Polelo ea Bothata Ha re bala mehato e tlase ho fumana bothata bo fanoeng, re fane ka sepheo sa ho kenya lintho [] tse nang le likarolo, re hloka ho bala palo e tlase ea ts'ebetso ho tloha ho fetoleng boholo ba [] sa size n le zeros tsohle ho tsepamisa [] . Ts'ebetso a) Ho eketsa karolo ka 1 ke ...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 260. Subarray le tse latelang Polelo ea Bothata Bothateng bo bokhutšoaane le bothateng, re tlameha ho hatisa lithutsoana le lipehelo tsohle tsa sehlopha se fanoeng. Hlahisa literene tse se nang letho tse ka bang teng. Karolo e nyane e hlalosoa e le karolo kapa karolo ea sehlopha moo ho ipapisa le maemo ho ipapisitseng le index. Ts'ireletso ...

Bala haholoanyane

Potso ea 261. 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 262. 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 263. Element e kholo e latelang ka tatellano Polelo ea Bothata Ha re fuoa lethathamo, re tla fumana karolo e latelang e kholo ea ntlha ka 'ngoe ka tatellano. Haeba ho se na ntlha e latelang e kholo ea ntho eo re tla hatisa -1, ho seng joalo re tla e hatisa. Tlhokomeliso: Ntho e latelang e kholo ke ntho e kholo le ...

Bala haholoanyane

Potso ea 264. 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 265. Fumana Ntlha e Tsitsitseng ka Lethathamo le Fuoeng Polelo ea Bothata Ha u fuoa mefuta e mengata ea likarolo tse fapaneng, fumana ntlha e sa fetoheng ka tatellano e fanoeng, moo ntlha e tsitsitseng e bolelang hore boleng ba elemente bo ts'oana le index. Mohlala Keketso ea 5 arr [] = {0,4,8,2,9} Sephetho sa 0 ke ntlha e sa fetoheng lethathamong lena hobane boleng le index ...

Bala haholoanyane

Potso ea 266. Fumana Element U Sebelisa Patlo ea Binary ho Li Array Array Polelo ea Bothata Ha u fuoa lethathamo le hlophisitsoeng, Fumana element u sebelisa patlo ea binary ka har'a sehlopha se hlophisitsoeng. Haeba e le teng, hatisa index ea element element e ngoe print -1. Mohlala Input arr [] = {1, 6, 7, 8, 9, 12, 14, 16, 26, 29, 36, 37, 156} X = 6 // element e lokelang ho phenyekolloa ...

Bala haholoanyane

Potso ea 267. 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 268. Fumana likopi ka tatellano ka tsela e sebetsang hantle Polelo ea Bothata Hlahisa likarolo tsohle tse etsahetseng ka tsela e sebetsang hantle ho feta ho O (n) le O (1). Ha ho fanoa ka boholo ba boholo ba n bo nang le linomoro ho tloha ho 0 ho ea ho n-1, linomoro tsena li ka hlaha makhetlo a mangata. Fumana likopi ka bongata ba tse sebetsang hantle ka ho fetesisa ...

Bala haholoanyane

Potso ea 269. 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 270. Fumana Baetapele Lethathamong Polelo ea Bothata e fuoe lethathamo le nang le likarolo tsa N. Fumana baetapele ka tatellano. Baetapele ke karolo e se nang karolo e kholo ho feta ea bona ka letsohong le letona la bona. Mohlala Keletso 7 1 95 4 46 8 12 21 Khumo 95 46 21 Tlhaloso Mona che ...

Bala haholoanyane

Potso ea 271. 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 272. Find K Length Subarray of Maximum average Polelo ea Bothata Ho fumana boholo ba bolelele ba karolelano ea K, re fane ka boholo ba boholo N. Ho fumana boemo ba tšebetso ea karoloana ea boholo ba k ka boholo ba karolelano. Sehlopha se ka ba le linomoro tse ntle le tse fosahetseng. (Karolelano = kakaretso ea likarolo / palo ...

Bala haholoanyane

Potso ea 273. Fumana Pythagorean Triplets ho tloha Array Polelo ea Bothata Re fane ka lenane le nang le linomoro tse ngata. Re hloka ho fumana sehlopha sa Pythagorean tse tharo ho tsoa sehlopheng se fanoeng. Tlhokomeliso: Maemo a mararo a Pythagorean: a ^ 2 + b ^ 2 = c ^ 2. Mohlala Input 6 [3, 4, 6, 5, 7, 8] Liphetho tsa Pythagorean triplets: 3, 4, 5 Atamela 1 ...

Bala haholoanyane

Potso ea 274. 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 275. Fumana sebaka se tlase pakeng tsa linomoro tse peli ka tatellano Polelo ea Bothata Lethathamong le fanoeng le sa hlophisoang, le ka bang le na le likopi, fumana sebaka se tlase lipakeng tsa linomoro tse peli tse fapaneng ka bongata. Sebaka se pakeng tsa linomoro tse 2 ka tatellano: phapang e felletseng lipakeng tsa li-indices +1. Ho kenya mohlala 12 3 5 4 2 6 5 6 6 5 4 ...

Bala haholoanyane

Potso ea 276. Palo ea Palo ea Liketsahalo ka tatellano e hlophiloeng Polelo ea Bothata Bothateng ba "Palo ea Liketsahalo ka tatellano e hlophisitsoeng", re fane ka lethathamo le hlophisitsoeng. Bala palo ea liketsahalo kapa makhetlo a mangata ka tatellano ea X moo X e leng palo e kholo. Keletso ea mohlala 13 1 2 2 2 2 3 3 3 4 4 ...

Bala haholoanyane

Potso ea 277. Palo e kahodimodimo ea Kakaretso ea Likarolo tse sa Tšoaneng Polelo ea Bothata Ho lenane la "Maximum Sum of Non Consecutive Elements", o hloka ho fumana lintlha tse sa latellanang. U ke ke ua eketsa linomoro tsa moahelani haufinyane. Mohlala [1,3,5,6,7,8,] mona 1, 3 li haufi kahoo re ke ke ra li eketsa, 'me tse 6, 8 ha li haufi kahoo re ...

Bala haholoanyane

Potso ea 278. 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 279. 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 280. 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 281. Fumana lipara tsohle ka phapang e fanoeng Polelo ea Bothata Re fane ka letoto la lintho tse fapaneng kapa ha ho na lintho tse phetoang tse teng ka tatellano. Fumana lipara tsohle ka phapang e fanoeng. Haeba ho se na li-pair tse fanoeng ka mokhoa o fapaneng joale hatisa "Ha ho na li-pair tse fuoeng tse fapaneng". Keletso ea mohlala 10 20 90 70 20 80 ...

Bala haholoanyane

Potso ea 282. 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 283. Phapang e kholo lipakeng tsa likarolo tse peli tse kang ntho e kholo e tla kamora tse nyane Polelo ea Bothata Re fane ka linomoro tse ngata moo re lokelang ho fumana phapang e kholo lipakeng tsa likarolo tse peli tse joalo ka ha likarolo tse kholo li tla kamora tse nyane. Kakanyo ea Mohlala 4 7 2 18 3 6 8 11 21 Khumo 19 Mokhoa oa 1 oa phapang e kholo lipakeng tsa likarolo tse peli ...

Bala haholoanyane

Potso ea 284. 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 285. Fumana Element ea Pele le ea Bobeli e Nyane Polelo ea Bothata Ho fumana bothata ba likarolo tsa pele le tsa bobeli tse nyane re fane ka palo ea linomoro. Fumana linomoro tse nyane tsa pele le tsa bobeli ho tsoa ho tse ngata kapa fumana linomoro tse nyane ho tse ling tse ngata. Keletso ea mohlala ea 7, 6, 8, 10, 11, 5, 13, 99 Khumo ea pele ho tse nyane ke ...

Bala haholoanyane

Potso ea 286. Fumana palo e etsahalang ka palo e sa tloaelehang ea linako ka tatellano Polelo ea Bothata e fuoe lethathamo la linomoro tse nepahetseng. Linomoro tsohle li hlaha esita le makhetlo a mangata ntle le palo e le 'ngoe e etsahalang ka makhetlo a makatsang. Re tlameha ho fumana palo e hlahang makhetlo a makatsang ka tatellano. Mohlala Input 1, 1, 1, 1, 2, 2, 3, ...

Bala haholoanyane

Potso ea 287. Hlopha Elements ka Makhetlo a Liketsahalo Polelo ea Bothata Ka likarolo tsa mofuta o itseng ka bothata ba makhetlo a liketsahalo, re fane ka letoto le []. Hlophisa likarolo tse ngata ka tsela eo karolo e nang le lipalo tse phahameng ka ho fetisisa e tlang pele. Haeba palo ea liketsahalo e lekana joale hatisa palo e hlahileng pele ho ...

Bala haholoanyane

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

Amazon String Lipotso

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

Bala haholoanyane

Potso ea 291. 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 292. 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 293. Kenya Phethahatso ea Tharollo (Sefate sa Prefix) Leetcode Tharollo Phatlalatso ea Bothata The Implement Trie (Prefix Tree) LeetCode Tharollo - "Implement Trie (Prefix Tree)" e u kopa ho kenya ts'ebetsong Sebopeho sa Trie Data se etsang ho kenya, ho batla le ho batlisisa ka mokhoa o nepahetseng. Mohlala: Kenyo: ["Trie", "kenya", "batla", "batla", "startsWith", "kenya", "batla"] [[], ["apple"], ["apple"], [ "app"], ["app"], ["app"], ["app"]] Sephetho: [null, null, true, false, true, null, true] Tlhaloso: Kamora ho kenya likhoele tsohle, trie e shebahala rata sena. Lentsoe apple le batlisisoa le ...

Bala haholoanyane

Potso ea 294. Palindrome Partitioning Leetcode Tharollo Polelo ea Bothata Tharollo ea Palindrome Partitioning LeetCode - "Palindrome Partitioning" e re o fuoa khoele, arola khoele e le hore karolo e 'ngoe le e 'ngoe ea karohano e be palindrome. Khutlisetsa karohano eohle ea palindrome ea khoele e kenang. Mohlala: Kenyelletso: s = "aab" Sephetho: [["a","a","b"],["aa","b"]] Tlhaloso: Ho na le tse 2 hantle tse nepahetseng ...

Bala haholoanyane

Potso ea 295. 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 296. Palindromic Substrings Leetcode Tharollo Polelo ea Bothata Tharollo ea LeetCode ea Palindromic Substrings - "Palindromic Substrings" e u kopa ho fumana palo e felletseng ea likhoele tse nyane tsa palindromic khoeleng ea ho kenya. Khoele ke palindrome ha e balla morao joalo ka pele. Substring ke tatelano e kopaneng ea litlhaku ka har'a khoele. Mohlala: Kenyo: s = "aaa" Sephetho: ...

Bala haholoanyane

Potso ea 297. Bolelele bo Holimo ba Khoele e Kopanetsoeng e nang le Tharollo ea Leetcode ea Litlhaku tse Ikhethang Polelo ea Bothata Bolelele bo Holimo ba Khoele e Kopanetsoeng e nang le Litlhaku tse Ikhethileng Tharollo ea LeetCode - "Bolelele bo Felletseng ba Khoele e Kopanetsoeng e nang le Litlhaku tse Ikhethileng" e re o filoe likhoele tse ngata mme o hloka ho khetha tatellano efe kapa efe ea lethathamo le fanoeng ebe o li kopanya. likhoele ho theha ...

Bala haholoanyane

Potso ea 298. Tharollo ea Leetcode ea Sebaka se Khutšoane ka ho Fetisisa Polelo ea Bothata The Shortest Word Distance LeetCode Solution - e re u fuoa letoto la likhoele le mantsoe a mabeli a fapaneng. Re hloka ho khutlisa sebaka se sekhutšoane pakeng tsa mantsoe ana a mabeli a hlahang khoeleng ea ho kenya. Mohlala: Kenyelletso: wordsDict = ["itloaetsa", "etsa", "perfect", "coding", "e etsa"], word1 = "coding", word2 = "itloaetsa" Sephetho: 3 Tlhaloso: Lentsoe “khouto” le hlaha ho boemo 4 ....

Bala haholoanyane

Potso ea 299. 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 300. Bonyane ba Mehato ea ho Etsa Likhoele tse peli Anagram Leetcode Solutions Polelo ea Bothata Bothateng bona, re fuoa likhoele tse peli 's' & 't' tse nang le litlhaku tse tlase tsa Senyesemane. Ketsahalong e le 'ngoe, re ka khetha mofuta ofe kapa ofe ka khoele' t 'ebe re o fetisetsa ho motho e mong. Re hloka ho fumana palo e tlase ea ts'ebetso e joalo ho etsa 't' an ...

Bala haholoanyane

Potso ea 301. 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 302. Lits'oants'o tse nyane tsa ho etsa likhoele li lekana le tharollo ea Leetcode Polelo ea Bothata U fuoa likhoele tse peli s1 le s2 tsa bolelele bo lekanang bo nang le litlhaku "x" le "y" feela. o ka chencha litlhaku tse peli hore ke tsa likhoele tse fapaneng, mosebetsi oa hau ke ho etsa hore khoele ka bobeli e lekane. khutlisa palo e nyane ea li-swaps tse hlokahalang ho etsa hore likhoele ka bobeli li lekane ...

Bala haholoanyane

Potso ea 303. Tlosa Tharollo ea Leetcode Tharollo ea Palindromic Bothata ba Tlosa Palindromic Latela Tlhahiso ea Leetcode e re o fuoe khoele. Khoele e na le litlhaku tse peli feela 'a' kapa 'b'. O kopuoa ho hlakola khoele eohle. Ho na le thibelo ea hore o ka hlakola feela palindromic ka mor'a moo. Fumana bonyane ...

Bala haholoanyane

Potso ea 304. Ho senya IP Aterese ea Leetcode Tharollo Polelo ea Bothata Bothateng bona, re fuoa Aterese ea IP. Re tlameha feela ho e fetolela ho Aterese ea IP e Hlophisitsoeng, ke hore, mochining oa rona oa tlhahiso, "". li fetoleloa ho "[.]". Mohlala # 1: aterese = "1.1.1.1" "1 [.] 1 [.] 1 [.] 1" # 2: address = "255.100.50.0" "255 [.] 100 [.] 50 [.] 0 [.] "Atamela 1 (U sebelisa String Stream / Sehahi) ...

Bala haholoanyane

Potso ea 305. Matching Matching in Array Leetcode Solution Bothata ba String Matching in Array Leetcode Solution e re fa letoto la likhoele. Bothata bo re kopa ho fumana liletsa tse likhoele tsa likhoele tse ling ho tsoa ho kenyelletso. Khopotso e potlakileng feela, substring ha se letho empa ke karolo ea khoele e setseng kamora ...

Bala haholoanyane

Potso ea 306. 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 307. 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 308. Kenya Binary Leetcode Tharollo Polelo ea Bothata Ha re fuoa likhoele tse peli tsa binary a le b, re tlameha ho kenyelletsa likhoele tsena tse peli ebe re khutlisa sephetho e le khoele ea binary. Khoele ea binary ke likhoele tse nang le li-0 le li-1 feela. Mohlala a = "11", b = "1" "100" a = "1010", b = "1011" "10101" Mokhoa oa ho eketsa tse peli ...

Bala haholoanyane

Potso ea 309. Tharollo ea Leetcode ea Palindrome e sebetsang Polelo ea Bothata Ha re fuoa mohala, re tlameha ho tseba hore na ke palindrome, re shebile feela litlhaku tsa alphanumeric ke hore linomoro le lialfabeta feela. Hape re tlameha ho hlokomoloha linyeoe tsa litlhaku tsa alfabeta. Mohlala "Monna, leano, kanale: Panama" Tlhaloso ea 'nete: "AmanaplanacanalPanama" ke palindrome e sebetsang. "matha koloi" ...

Bala haholoanyane

Potso ea 310. Khutlisa liluma-nosi tsa Tharollo ea Leetcode ea String Polelo ea Bothata Bothateng bona ho fanoa ka khoele 'me re tlameha ho khutlisa liluma-nosi feela tsa khoele ena. Mohlala "hello" "holle" Tlhaloso: pele o khutlisa: "hello" kamora ho khutlisa: "holle" "leetcode" "leotcede" Tlhaloso: Atamela 1 (Using Stack) Re tlameha feela ho khutlisa liluma-nosi tse teng ha re kenya ...

Bala haholoanyane

Potso ea 311. 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 312. Tharollo ea Tsela ea ho tšela Leetcode Polelo ea Bothata Bothateng ba ho haola tsela a_string e fanoa moo ho nang le litlhaku tse 'ne feela tse fapaneng tsa' N ',' S ',' E 'kapa' W 'tse bonts'ang motsamao oa ntho ka lehlakoreng le le leng ka yuniti e le' ngoe. Ntho e qalong e tsoa ho eona (1). Re tlameha ho fumana hore na ...

Bala haholoanyane

Potso ea 313. Atisa Tharollo Leetcode Tharollo Bothata ba Multiply Strings Leetcode tharollo e re kopa ho atisa likhoele tse peli tseo re li fuoang hore re li kenye. Re kopuoa ho hatisa kapa ho khutlisa sephetho sena sa ho ikatisa mosebetsing oa moletsi. Ho e beha ka mokhoa o hlophisitsoeng ka likhoele tse peli, fumana sehlahisoa sa likhoele tse fanoeng. ...

Bala haholoanyane

Potso ea 314. 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 315. Khoele ea Scramble Polelo ea Bothata Bothata ba "Scramble String" e re o fuoa likhoele tse peli. Lekola hore na khoele ea bobeli ke khoele ea pele kapa che? Tlhaloso A re khoele s = "e kholo" Boemeli ba s joalo ka sefate sa binary ka ho bo arola khafetsa ka likhoele tse peli tse se nang letho. Khoele ena e ka ba ...

Bala haholoanyane

Potso ea 316. Liemahale tsa Sehlopha Re tlameha ho fumana li-anagrams tsa sehlopha tsa mantsoe a fanoeng. Sena se bolela lentsoe le leng le le leng re tla le hlophisa ebe re le boloka e le senotlolo le kenyelletso ea mantlha e sa hlophisoang joalo ka boleng mme haeba kenyelletso efe kapa efe e na le boleng bo lekanang le ba ...

Bala haholoanyane

Potso ea 317. Kakaretso ea mantsoe a Senyesemane Mathateng "Mantsoe a mangata a Senyesemane" re fane ka palo e se nang liphoso le mesebetsi ea ho fetolela palo eo ho mantsoe a eona a linomoro kapa re fumana palo, nomoro efe kapa efe, mme mosebetsi oa rona ke ho emela palo eo ka khoele foromo. Ha re boneng mohlala o le mong, ...

Bala haholoanyane

Potso ea 318. Fumana Range e Nyane haholo e nang le Elements ho tsoa ho L Manane Bothateng "Fumana lethathamo le lenyenyane ka ho fetisisa le nang le likarolo ho tsoa ho lethathamo la k" re fane ka manane a K a hlophiloeng le a boholo bo lekanang N. E kopa ho fumana mofuta o monyane haholo o nang le bonyane likaroloana ho tsoa lenaneng ka leng la K . Haeba ho na le tse fetang bonngoe ...

Bala haholoanyane

Potso ea 319. Litsi tse nyane tsa ho theha palindrome ka tumello e lumelletsoeng Bothata "Ho kentsoe bonyane ba ho etsa palindrome e nang le tumello e lumelletsoeng" ho re o fuoe Khoele e nang le litlhaku tsohle ka litlhaku tse nyane. Polelo ea bothata e kopa ho fumana bonyane ho kengooa ha tlhaku mohalong hore e ka ba Palindrome. Boemo ba litlhaku e ka ba ...

Bala haholoanyane

Potso ea 320. LCS (Nako e telele ka ho fetisisa e latelang) ea likhoele tse tharo Bothata "LCS (Longest Common Papatso e latelang) ea likhoele tse tharo" e re o filoe likhoele tse 3. Fumana tatellano e telele ka ho fetesisa ea likhoele tsena tse tharo. LCS ke khoele e tloaelehileng har'a likhoele tse tharo mme e entsoe ka litlhaku tse nang le tatellano e tšoanang ho tsohle ...

Bala haholoanyane

Potso ea 321. Lekola hore na lenane le na le linomoro tse kopaneng tse nang le likopi tse lumelletsoeng U fuoa linomoro tse ngata tse ka bang le likarolo tse tšoanang. Polelo ea bothata e botsa ho fumana hore na ke sehlopha sa linomoro tse kopaneng, hatisa "Ee" haeba ho joalo, hatisa "Che" haeba ho se joalo. Mohlala oa Keletso: [2, 3, 4, 1, 7, 9] Mohlala ...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 323. Lekola Palindrome kamora Potso e 'ngoe le e' ngoe ea batho bao u ka e fetisang Bothata "Hlahloba Palindrome kamora 'Potso e' ngoe le e 'ngoe ea batho ba khethiloeng" ho bolela hore ha re re o filoe khoele' me che. ea Lipotso, potso e 'ngoe le e' ngoe e na le litekanyetso tse peli tsa ho kenya linomoro tse kang i1 le i2 le kenyelletso e le 'ngoe e bitsoang' ch '. Polelo ea bothata e kopa ho fetola litekanyetso ho i1 le ...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 325. 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 326. Nomoro ea bonyane ba foromo ho latela tatellano e fanoeng Bothata "Fomoro palo e nyane ho latela tatellano e fanoeng" e re o fuoe mohlala oa nna le oa D feela. Moelelo oa Ke emela ho eketseha le ho fokotseha re fuoang D. Setatemente sa bothata se kopa ho hatisa palo e nyane e khotsofatsang paterone e fanoeng. Re na le ...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 329. Fetolela mantsoe ka bomong Polelo ea Bothata Bothata "Ho fetola mantsoe ka bomong" ho bolela hore u fuoe khoele s. Hona joale, hatisa setšoantšo sa mantsoe ka bomong ka khoeleng. Mohlala s = "TutorialCup - ho fetola tsela ea ho ithuta" puClairotuT - gnignahc eht yaw fo gninrael s = "Ho fetola mantsoe ka bomong" esreveR ...

Bala haholoanyane

Potso ea 330. 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 331. Linomoro tse nyane tsa likarolo tsa sebopeho li baloa ka khoele e fanoeng kamora ho tlosa litlhaku tsa k Polelo ea Bothata Bothata "Linomoro tse nyane tsa likarolo tsa semelo li baloa ka khoele e fanoeng kamora ho tlosa litlhaku tsa k" e re o fuoe khoele e nang le litlhaku tse tlase feela. U lumelloa ho tlosa litlhaku tsa k mohala ka hore mohaleng o setseng kakaretso ea ...

Bala haholoanyane

Potso ea 332. Mokoloko o thehiloe moleng oa motho oa pele ea sa pheta-phetoeng molatsoaneng Polelo ea Bothata Bothata "Mokhahlelo o ipapisitseng le lethathamo la motho oa pele ea sa pheteng molatsoaneng" o re o fuoe molapo o nang le litlhaku tse tlase, fumana motho oa pele ea sa pheteng neng kapa neng ha ho eketsoa tlhaku e ncha molatsoaneng, mme haeba ho le joalo ha ho khutliso ea semelo se sa pheta -1. Mehlala aabcddbe ...

Bala haholoanyane

Potso ea 333. Foromo e nyane ea Foromo ho latela tatellano e fanoeng Polelo ea Bothata Bothata "Foromo e Nyane ea Fomu ho Tloha ho tatellano e fanoeng e re o fuoe khoele ea bolelele / boholo n e emelang sebopeho sa litlhaku 'I' ke hore ho eketsa le 'D' ke ho fokotseha feela. Hatisa palo e tlase bakeng sa paterone e fanoeng ka linomoro tse ikhethileng ho tloha ho 1-9. Mohlala - ...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 335. Hlophisa linomoro tse fanoeng ho etsa palo e kholo ka ho fetisisa Polelo ea Bothata Ha re re u na le palo ea linomoro. Bothata "Hlophisa linomoro tse fuoeng ho etsa palo e kholo ka ho fetesisa" e kopa ho hlophisa mabotho ka tsela eo sehlahisoa se lokelang ho ba boleng bo holimo bo ka etsoang ka linomoro tsa sehlopha. Mohlala [34, 86, 87, ...

Bala haholoanyane

Potso ea 336. Karohano ea Palindrome Polelo ea Bothata Ha u fuoa khoele, fumana palo e fokolang ea ho khaola ho hlokahalang hore likaroloana tsohle tsa likarolo ke li-palindromes. Kaha re khaola khoele ea rona ea mantlha ka likarolo tse fapaneng joalo ka ha likaroloana tsohle e le li-palindromes, bothata bona re bo bitsa Bothata ba Karolo ea Palindrome. Mohlala asaaaassss 2 Tlhaloso: ...

Bala haholoanyane

Potso ea 337. 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 338. Boholo ba phetoho ea boima ba khoele e fanoeng Polelo ea Bothata Phetoho e phahameng ea boima ba bothata ba khoele e fanoeng e re e fuoe khoele e nang le litlhaku tse peli feela 'A' le 'B'. Re na le ts'ebetso moo re ka fetolang khoele hore e be khoele e ngoe ka ho fetola mofuta o fe kapa o fe. Kahoo liphetoho tse ngata lia khoneha. Ho tsoa hohle kamoo ho ka khonehang ...

Bala haholoanyane

Potso ea 339. Bothata ba Letlapa la Keypad la mobile Polelo ea Bothata Mathateng a mobile keypad bothata, re nahana ka keypad ea linomoro. Re hloka ho fumana palo eohle ea tatellano ea linomoro tsa bolelele bo fanoeng hoo o lumelloang feela ho tobetsa likonopo tse holimo, tlase, ka ho le letšehali le ka ho le letona la konopo ea hajoale. Ha ua lumelloa ...

Bala haholoanyane

Potso ea 340. Palindrome e khuts'oane Bothateng bo bokhutšoaane ba palindrome, re file khoele ea bolelele l. Kenya litlhaku ka pela eona ho e etsa palindrome haeba ho se joalo. Hatisa lipalo tse nyane haholo tse sebelisitsoeng ho etsa khoele e fuoeng palindrome. Keletso ea Mohlala: s = abc Output: 2 (ka ...

Bala haholoanyane

Potso ea 341. Lentsoe la Bobeli le phetoang ka tatellano Ha ho fanoa ka tatellano ea likhoele, mosebetsi ke ho fumana lentsoe kapa khoele ea bobeli e phetoang khafetsa. (Ha ho nahanoa hore ha ho na mantsoe a mabeli a phetoang khafetsa, ho tla lula ho e-na le lentsoe le le leng). Keletso ea Mohlala: {"aaa", "bb", "bb", "aaa", "aaa", c "} Sephetho: Khoele e nang le ...

Bala haholoanyane

Potso ea 342. Boholo bo hlahang tlhakung Ho fanoe ka khoele ea boholo n e nang le litlhaku tse nyane. Re hloka ho fumana palo e kholo ea litlhaku tse hlahang khoeleng. Haeba ho na le litlhaku tse fetang bonngoe tse nang le liketsahalo tse ngata, joale hatisa leha e le efe ea tsona. Kenyelletso ea Mohlala: Khoele s=”teko” Sephetho: Boholo bo hlahang tlhaku ke 't'. Mokhoa oa 1: Ho sebelisa ...

Bala haholoanyane

Potso ea 343. 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 344. Fetola sebaka Bothateng ba ho hlophisa hole re tlameha ho fumana palo e tlase ea ts'ebetso e hlokahalang ho fetolela khoele X ea bolelele n ho khoele e ngoe Y ea bolelele ba m. Ts'ebetso e lumelletsoe: Ho kenya Tloso ea Mohlala Mohlala Keketso: String1 = "abcd" String2 = "abe" Sephetho: Bonyane ba ts'ebetso e hlokahalang ke 2 (...

Bala haholoanyane

Potso ea 345. Substring Ka Concatenation Ea Mantsoe Ohle Ha re tsamaisa moelelo oa bothata ba mantsoe ohle, re fane ka khoele s mme lenane le na le mantsoe a mangata bolelele bo lekanang. Hatisa index ea ho qala ea substring e ka bang litholoana tsa ho kopanya mantsoe ohle a lenaneng ho ...

Bala haholoanyane

Potso ea 346. Bonyane ba Bracket bo fetoha Bothateng bo tlase ba phetoho ea bracket, re file likhoele tse nang le polelo ea '{' le '}' feela. Fumana palo e nyane ea ho fetoha ha bracket e hlokahalang ho etsa hore polelo e leka-lekane. Mohlala Input: s = “} {” Output: 2 Input: s = “{{{” Output: The expression expression is not ...

Bala haholoanyane

Potso ea 347. Polelo e na le bracket e sa hlokeheng kapa che Ho fanoe ka khoele s e nang le polelo ea li-opareitara, li-operand le li-parenthesis. Fumana hore na khoele e fanoeng e na le masakana a sa hlokahaleng ntle le moo polelo e ntseng e tla fana ka sephetho se ts'oanang. Ka mantsoe a mang, re tlameha ho fumana polelo eo e na le bracket e sa hlokeheng kapa che. Bracket e sa Hlokeheng Haeba e ...

Bala haholoanyane

Potso ea 348. Lekola hore na lipolelo tse peli tse nang le libakete li ts'oana Ho fanoe ka likhoele tse peli s1 le s2 tse emelang lipolelo tse nang le sesebelisoa sa tlatsetso, sesebelisoa sa ho tlosa, lialfabeta tse nyane le li-parenthesis. Lekola hore na lipolelo tse peli tse nang le masakaneng lia tšoana. Mohlala Input s1 = “- (a + b + c)” s2 = “-abc” Tlhahiso Ee Keketso s1 = “ab- (cd)” s2 = “abcd” Output No Algorithm ho Lekola hore na e 'Meli ...

Bala haholoanyane

Potso ea 349. Khoele ea Parenthesis e sebetsang Bothateng bo nepahetseng ba likhoele tsa masakaneng re fane ka khoele e nang le '(', ')' le '*', hlahloba hore na khoele e leka-lekane haeba '*' e ka nkeloa sebaka ke '(', ')' kapa khoele e se nang letho. Mehlala Keletso "()" Ketso ea 'nete Input "*)" Tlhahiso ea' nete Input "(*))" Output True Naive Approach for ...

Bala haholoanyane

Potso ea 350. Nako e telele ka ho fetesisa ea Palindromic Mathateng a malelele ka ho fetesisa a palindromic ao re a fileng khoele, fumana bolelele ba nako e telele ka ho fetesisa ea palindromic. Keketso ea Mehlala: TUTORIALCUP Phatlalatso: Keletso e 3: Phatlalatso ea DYNAMICPROGRAMMING: Tsela e 7 e se nang tsebo bakeng sa Palo e telele ka ho Fetisisa ea Palindromic Mokhoa o hlokang kelello oa ho rarolla bothata bo kaholimo ke ho hlahisa liketsahalo tsohle tsa ...

Bala haholoanyane

Potso ea 351. Algorithm ea KMP K algorithm ea KMP (Knuth-Morris-Pratt) e sebelisetsoa ho batla paterone khoeleng e fanoeng. Re fuoe khoele S le paterone p, sepheo sa rona ke ho bona hore na paterone e fanoeng e teng ka har'a thapo kapa che. Keletso ea Mohlala: S = "aaaab" p = "aab" Sephetho: Mokhoa oa 'nete oa ho hloka tsebo The ...

Bala haholoanyane

Potso ea 352. Sheba li-Parentheses tse leka-lekaneng ka polelo Ho fuoe khoele ea bolelele n. Hlahloba hore na ho na le masakana a koalang masakaneng a mang le a mang a qalang, ke hore, haeba masakana ohle a lekana. Ka mantsoe a mang, re ka boela ra re, haeba re na le '}', ')' le ']' bakeng sa '{', '(' le '[' ka ho latellana, polelo ...

Bala haholoanyane

Potso ea 353. Fumana hore na Tlhaloso e na le Pasehesis e Kopilitsoeng kapa Che E filoe khoele e nang le masakana a leka-lekaneng. Fumana hore na polelo / khoele e na le masakana a kopilitsoeng kapa che. Duplicate Parenthesis Ha polelo e le bohareng kapa e lika-likelitsoe ke mofuta o tšoanang oa masakana a leka-lekaneng, ke hore e kentsoe lipakeng tsa mofuta o tšoanang oa ho bula le ho koala masakana ho feta hang.

Bala haholoanyane

Potso ea 354. Fumana Boholo bo tebileng ba li-Parenthesis tse Nested ka khoele Fuoa khoele s. Ngola khoutu ho hatisa botebo bo boholo ba li-parenthesis ka sehokelong se fanoeng. Keletso ea Mohlala: s = “(a (b) (c) (d (e (f) g) h) I (j (k) l) m)” Tlhahiso: 4 Input: s = “(p ((q) Tlhahiso: 3 U sebelisa Algorithm ea Stack Qala khoele ea bolelele ...

Bala haholoanyane

Potso ea 355. Polelo e leka-lekaneng ka Phetolo Ka Phatlalatso e Leka-lekanang le bothata ba Phetolo re fane ka likhoele tse nang le masakaneng ke hore '(', ')', '[', ']', '{', '}'. Khoele e boetse e na le x libakeng tse ling e le sebaka sa li-parenthesis. Lekola hore na khoele e ka fetoloa poleloana e nang le masakana a nepahetseng kamora ho tlosa tsohle ...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 357. Selelekela ho Phetoho ea Infix Sehlomathisong sa bothata ba ho fetoha ha infix, re fane ka polelo ka mongolo wa ketapele. Ngola lenaneo ho e fetola infix expression. Sengoloa sa Prefix In notation ena li-operand li ngoloa kamora mosebelisi. E boetse e tsejoa e le Sepheo sa Poland. Mohlala: + AB ke sehlongwapele. ...

Bala haholoanyane

Potso ea 358. Postfix ho Phetoho ea Infix Ka bothata ba ho sokoloha ha postfix, re fane ka polelo ka mongolo oa postfix. Ngola lenaneo ho fetola notation e fanoeng ka infix notation. Infix Notation Ketsahalong ena, lisebelisoa li ngotsoe lipakeng tsa li-opereishene. E ts'oana le tsela eo ka kakaretso re ngolang polelo. Mohlala: A + ...

Bala haholoanyane

Potso ea 359. Setsi sa pele ho Phetoho ea Postfix Sehlomathisong sa bothata ba phetoho ea postfix, re fane ka polelo ka mongolo oa pele ho sebopeho sa mohala. Ngola lenaneo ho fetolela notation e fanoeng ka mongolo oa postfix. Sengoloa sa Prefix Ho notation ena, re ngola li-opereishene kamora mosebelisi. E boetse e tsejoa e le Sepheo sa Poland. Mohlala: + AB ke ...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 362. Mohlala o phetoang oa Substring Mekhoeng e pheta-phetoang ea li-substring re fane ka cheke ea hore na e ka hahuoa ka ho nka mohala oa eona ka boeona le ho kenya likopi tse ngata tsa mohala hammoho. Mohlala Input 1: str = “abcabc” Sephetho: Tlhaloso ea 'nete: "abcabcabc" e ka theoa ka ho kenya "abc" khafetsa khoeleng e se nang letho. ...

Bala haholoanyane

Potso ea 363. Lethathamo la Taba ea Lengolo Lengolong la tumello re fane ka khoele e nang le lialfabeta le linomoro feela, sebopeho se seng le se seng se khoeleng se ka fetoloa ho ba litlhaku tse nyane le litlhaku tse kholo, fumana likhoele tsohle tse fapaneng tse ka fumanoang mefuteng e fapaneng ea litlhaku tse nyane le tse kholo tsa sebapali se seng le se seng khoele. Mohlala ...

Bala haholoanyane

Potso ea 364. 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 365. Backspace String Bapisa Ka khoele ea backspace bapisa bothata boo re bo fileng likhoele tse peli S le T, hlahloba hore na lia lekana kapa che. Hlokomela hore likhoele li na le '#' e bolelang sebopeho sa backspace. Mehlala Input S = “ab # c” T = “ad # c” Phello ea 'nete (joalo ka ha S le T li fetohela ho "ac") Ho kenya ...

Bala haholoanyane

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

Bala haholoanyane

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

Bala haholoanyane

Potso ea 369. Khatello ea khoele Bothateng ba khatello ea khoele, re fane ka mefuta e mengata ea mofuta oa char. E hatella joaloka sebopeho le palo ea motho ea itseng (haeba palo ea sebapali e le 1 joale sebopeho se le seng se bolokoa ka bongata). Bolelele ba sehlopha se petelitsoeng bo lokela ...

Bala haholoanyane

Potso ea 370. 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 371. 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 372. Nomoro e sebetsang Bothateng ba Nomoro e Sebetsang eo re e fileng khoele, sheba hore na e ka hlalosoa e le nomoro e nepahetseng ea decimal. Ho lokela ho hlokomeloa hore, bakeng sa khoele e fanoeng e ka hlalosoa e le nomoro e nepahetseng ea decimal. E lokela ho ba le litlhaku tse latelang: Numere 0-9 Exponent - “e” ...

Bala haholoanyane

Potso ea 373. Fumana nomoro e haufi ka ho fetisisa ea Palindrome Bothata ba ho Fumana bothata ba nomoro ea Palindrome e haufi ka ho fetisisa eo re e fileng nomoro n. Fumana nomoro e palindrome mme phapang e felletseng lipakeng tsa palindromic nomoro ea n ke bonyane kamoo ho ka khonehang ntle le zero. Haeba ho na le palo e fetang e le 'ngoe e khotsofatsang boemo bona, hatisa ...

Bala haholoanyane

Potso ea 374. Bala 'me U re Bala 'me u bue moo re faneng ka nomoro ea N' me re hloka ho fumana kotara ea Nth ea palo ebe re re tatellano. Pele, re hloka ho utloisisa se baloang le tatellano. Pele, bona mantsoe a mang a tatellano: poleloana ea 1 ke "1". Polelo ea 2 ke ...

Bala haholoanyane

Potso ea 375. Fumana sebapali se ikhethileng ka khoele Ho Fumana sebapali se ikhethileng bothateng ba khoele, re file khoele e nang le lialfabeta tse tlase feela (az). Re hloka ho fumana semelo sa pele se sa pheta-phetoang ho eona ebe re hatisa index. haeba ho se mofuta o joalo o teng hatisa -1. Mofuta oa Keketso Ke mola o le mong o nang le khoele. Sebopeho sa Khatiso ...

Bala haholoanyane

Potso ea 376. Kakaretso ho Roma Kakaretso ea phetoho ea Roma. Re fane ka nomoro N mme re hloka ho printa palo ea Roma ea N. Linomoro tsa Roma li emetsoe ke ts'ebeliso ea litekanyetso tsa {I, V, X, L, C, D, M}. Ha re boneng mehlala e meng ea kutloisiso e ntle. Fomate ea ho Kena Ke mohala o le mong o nang le ...

Bala haholoanyane

Potso ea 377. Algorithm ea Rabin Karp Rabin Karp Algorithm e ne e tloaetse ho fumana mohala oa paterone khoeleng e fanoeng. Ho na le mefuta e mengata haholo ea li-algorithms kapa mekhoa e sebelisetsoang ho fumana khoele ea paterone. Ka algorithm ena, re sebelisa Hashing bakeng sa ho fumana mokhoa o tšoanang. Haeba re na le khoutu e tšoanang ea hash bakeng sa substring ...

Bala haholoanyane

Potso ea 378. Nahana Lentsoe Nahana hore Lentsoe ke bothata bo kopanetsoeng. Bothata bo kopanetsoeng bo bolela hore data eo re e fuoang ha e reroe esale pele. Re ka hatisa boleng kapa ra letsetsa ts'ebetso e ikhethileng ho sebelisana kapa ho fumana tlhaiso-leseling e batsi mabapi le tharollo. Kamora mohato o mong le o mong, re boetse re hloka ho FIHUSetsa buffer ho ...

Bala haholoanyane

Potso ea 379. Likhetho Tse Ikhethileng Ha re fuoa likhoele tse peli S le P1, re tlameha ho bala palo eohle ea likhetho tse ikhethileng tsa S tse lekanang le P1. Tlhokomeliso: Ho latela khoele e fanoeng ke khoele eo re e bolokang ka ho hlakola litlhaku tse ling kapa litlhaku tse ka bang teng tsa zero ho tsoa mohalong oa pele. Re ka se fetohe ...

Bala haholoanyane

Potso ea 380. Likhoele tsa Isomorphic Likhoele tsa Isomorphic - Ha ho fanoa ka likhoele tse peli re hloka ho lekola hore na ketsahalong e ngoe le e ngoe ea sebapali sa khoele1 ho na le 'mapa o ikhethileng o nang le litlhaku tsa khoele2. Ka bokhutšoanyane, sheba hore na ho na le 'mapa o le mong ho ea ho o mong kapa che. Mohlala Input str1 = "aab" str2 = "xxy" Output True ...

Bala haholoanyane

Potso ea 381. Etsa String Shifts Leetcode Phetoho ke mokhoa oo lialfabeta li eketsoang ka 1 ka boleng ba tsona ba ASCII. Bakeng sa alfabeta ea ho qetela z e qala hape ke hore phetoho ea z e tla ba. Ha re sebetsana le mathata a leetcode, re fane ka khoele s (litlhaku tse nyane feela) le sehlopha [...

Bala haholoanyane

Potso ea 382. Papiso ea likhoele e nang le likarete tse hlaha Papisong ea String e nang le bothata ba likarete tsa hlaha, re file likhoele tse peli khoele ea bobeli e na le lialfabeta tse nyane mme ea pele e na le lialfabeta tse nyane le mekhoa e meng ea likarete tsa hlaha. Mekhoa ea likarete tsa hlaha ke:?: Re ka khutlisa karete ena e hlaha ka litlhaku tse nyane. *: Re ka nka sebaka sa karete ena e hlaha ka mohala ofe kapa ofe. Ha e na letho ...

Bala haholoanyane

Potso ea 383. Hlahloba hore na Likhoele li K Distance Apart kapa Che Polelo ea Bothata Ha u fuoa likhoele tse peli le palo e kholo ea k, ngola lenaneo ho lekola hore na likhoele tse fanoeng li arohane kapa che. Ke hore haeba sebapali sefe kapa sefe se sa tšoane hantle kapa sebapali sefe kapa sefe se lokela ho tlosoa ka nako eo se tsejoa e le k hole hole. Sebopeho sa Input sa Pele ...

Bala haholoanyane

Potso ea 384. Hlahisa likhoele tsohle tsa Binary ntle le ho latela 1's Polelo ea Bothata Bothateng ba "Hlahisa likhoele tsohle tsa binary ntle le tatellano ea 1" re fane ka palo e kholo ea k, ngola lenaneo ho hatisa likhoele tsohle tsa binary tsa size k ntle le 1 e latellanang. Fomate ea ho Kena Mohala oa pele ebile e le 'ngoe feela o nang le lenane le felletseng la Phallo ea Phallo kaofela ho khoneha ...

Bala haholoanyane

Potso ea 385. 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 386. 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 387. 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 388. Hatisa likarolo tsohle tsa Palindromic tsa String Polelo ea Bothata Bothateng ba "Hatisa likarolo tsohle tsa Palindromic tsa String" re fane ka khoele "s". Ngola lenaneo ho hatisa likarolo tsohle tsa pal. Palindrome ke lentsoe, nomoro, polelo, kapa tatellano e 'ngoe ea litlhaku tse balang morao ka morao ho ea pele joalo ka ...

Bala haholoanyane

Potso ea 389. 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 390. Bonyane ba Botho ba lokelang ho eketsoa ka pele ho etsa String Palindrome Polelo ea Bothata Bothateng ba "Bonyane ba Botho bo lokelang ho eketsoa ka pele ho etsa String Palindrome" re file khoele "s". Ngola lenaneo ho fumana litlhaku tse tlase tse lokelang ho kenyelletsoa kapele ho etsa palindrome ea khoele. Fomate ea ho Kena Mohala oa pele 'me e le' ngoe feela o nang le ...

Bala haholoanyane

Potso ea 391. Kth Sebopeho se sa pheteng Polelo ea Bothata Ho "Kth Non-repeat Character" re fane ka khoele "s". Ngola lenaneo ho fumana kth non-repeat -character. Haeba ho na le litlhaku tse ka tlase ho k tse sa pheta-phetoang khoeleng, hatisa "-1". Fomete ea Input Mohala oa pele le o le mong feela o nang le khoele “s”. ...

Bala haholoanyane

Potso ea 392. Tlosa Bonyane ba Botho e le hore Likhoele tse peli e be Lipapatso Polelo ea Bothata Bothateng ba "Tlosa Bonyane ba Botho e le hore likhoele tse peli li fetohe li-anagrams" re file likhoele tse peli tsa ho kenya. Fumana palo e tlase ea_e litlhaku tse lokelang ho tlosoa likhoeleng tsena tse peli hore li tle li fetohe anagrams. Fomate ea ho kenya Mohala oa pele o nang le khoele “s”. Mohala oa bobeli o nang le ...

Bala haholoanyane

Potso ea 393. Hlahisa likhoele tsohle tsa Binary ho tsoa ho Mohlala o fanoeng Polelo ea Bothata Bothateng ba "Hlahisa likhoele tsohle tsa Binary ho tsoa ho Mohlala o Fuoeng" re fane ka khoele ea ho kenya "s" e na le 0, 1, le? (char ea hlaha). Re hloka ho hlahisa likhoele tsohle tse fumanehang ka bongata ka ho li nkela sebaka? ka '0' le '1'. Fomate ea ho Kena Mohala oa pele ebile e le 'ngoe feela o nang le ...

Bala haholoanyane

Potso ea 394. Hatisa Litsela tsohle tse ka khonehang tsa ho roba khoele ka foromo ea bracket Polelo ea Bothata Bothateng ba "Hatisa Litsela tsohle tse ka khonehang tsa ho roba khoele ka foromo ea bracket", re fane ka khoele "s". Fumana mekhoa eohle e ka khonehang ea ho khaola khoele e fanoeng ka foromo ea bracket. Koala likhoele tsohle ka har'a masakaneng (). Fomate ea ho Kena Mohala oa pele ebile e le 'ngoe feela o nang le ...

Bala haholoanyane

Potso ea 395. Cesare Cipher Tlhaloso Theknoloji ea Cesher Cipher ke e 'ngoe ea mekhoa ea pele ea ho ngolla. Mona, bakeng sa tlhaku ka 'ngoe e ngotsoeng, e nkeloa sebaka ke tlhaku palo e lekantsoeng ea maemo ho latela alfabeta. Haeba n = 1, tlosa A ka B, B e tla fetoha C, joalo-joalo ...

Bala haholoanyane

Potso ea 396. 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 397. 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 398. 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 399. Litumello tsa khoele e fanoeng e sebelisa STL Polelo ea Bothata Mathateng a "Litumello tsa mohala o fanoeng o sebelisa STL", re fane ka khoele "s". Hatisa litumello tsohle tsa khoele ea ho kenya u sebelisa mesebetsi ea STL. Fomete ea Input Mohala oa pele le o le mong feela o nang le khoele “s”. Sebopeho sa Khatiso Hatisa tumello eohle ea se fanoeng ...

Bala haholoanyane

Potso ea 400. Nako e telele ka ho fetisisa e tloaelehileng e sebelisang ho arola le ho hlōla Polelo ea Bothata Bothateng ba "Longest Common Prefix e sebelisang Divide and Conquer" bothata, re fane ka likhoele tse ngata tsa n le n. Ngola lenaneo le tla hatisa selelekela se tloaelehileng ka ho fetisisa. Haeba ho se na sehlongwapele se tloaelehileng, ngola “-1”. Fomate ea ho Kena Mohala oa pele o na le palo e kholo n. ...

Bala haholoanyane

Potso ea 401. 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 402. Litumello tsa Palindrome tsa khoele Polelo ea Bothata Mathateng a "Palindrome Permutations of a String", re fane ka khoele ea "s". Hatisa li-palindromes tsohle tse ka hlahisoang ho sebelisoa litlhaku tsa khoele. Fomete ea Input Mohala oa pele le o le mong feela o nang le khoele “s”. Sebopeho sa Khatiso Hatisa hohle kamoo ho ka khonehang ...

Bala haholoanyane

Potso ea 403. 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 404. 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 405. 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 406. Foromo e nyane ea Foromo ho latela tatellano e fanoeng ea li-D le tsa ka Polelo ea Bothata Bothateng ba "Fomoro e Nyane ea Foromo ho tloha tatelanong ea tatellano ea D's le Nna", re fane ka paterone e nang le li-D le li-D feela. Ke bakeng sa ho eketseha le D bakeng sa ho fokotseha. Ngola lenaneo ho hatisa palo e tlase ho latela paterone eo. Lidijiti ho tloha ho 1-9 le lipalo ha li khone ho pheta. Mofuta oa Keketso ...

Bala haholoanyane

Potso ea 407. 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 408. 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 Amazon

Potso ea 409. 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 410. Hlakola Li-Node le Tharollo ea ho Khutlela Forest Leetcode Phatlalatso ea Bothata The Delete Nodes and Return Forest LeetCode Solution - "Tlosa Li-Nodes le Return Forest" e bolela hore ho fanoe ka motso oa sefate sa binary moo node e 'ngoe le e' ngoe e nang le boleng bo ikhethang. Re boetse re fuoa lethathamo, ho_delete, moo re hlokang ho hlakola li-node tsohle tse nang le litekanyetso tse teng ...

Bala haholoanyane

Potso ea 411. 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 412. 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 413. Motso oa tsela ea Leaf o nang le sepheo sa sepheo sa Leetcode Solutions Ho fanoa ka sefate sa binary le linomoro tse K Morero oa rona ke ho khutla hore na ho na le tsela ea motso ho ea ho lekhasi sefateng hoo e leng hore kakaretso e lekana le sepheo-K. Kakaretso ea tsela ke kakaretso ea li-node tsohle tse holim'a eona. 2 / \ ...

Bala haholoanyane

Potso ea 414. Khoele ea Scramble Polelo ea Bothata Bothata ba "Scramble String" e re o fuoa likhoele tse peli. Lekola hore na khoele ea bobeli ke khoele ea pele kapa che? Tlhaloso A re khoele s = "e kholo" Boemeli ba s joalo ka sefate sa binary ka ho bo arola khafetsa ka likhoele tse peli tse se nang letho. Khoele ena e ka ba ...

Bala haholoanyane

Potso ea 415. Lipotso tsa Palo ea Likarolo tse Ikhethileng ka har'a Subarray Re fane ka lethathamo la palo e felletseng le lipotso tse 'maloa' me re tlameha ho fumana palo ea likarolo tsohle tse fapaneng tseo re nang le tsona ka har'a sebaka se fanoeng, potso e na le linomoro tse peli tse setseng le ho le letona, ona ke moeli o fanoeng, le sena sebaka se fanoeng re ...

Bala haholoanyane

Potso ea 416. Tsela ea Morris Ho haola ha Morris ke mokhoa oa ho haola li-node tsa sefate sa binary ntle le ho sebelisa stack le recursion. Ka hona, ho fokotsa ho rarahana ha sebaka hore e be moleng. Mohlala oa Tsela e sa Lebelloang 9 7 1 6 4 5 3 1 / \ 2 ...

Bala haholoanyane

Potso ea 417. Kth moholo-holo oa node ea sefate sa binary Polelo ea Bothata Bothata "Kth moholo-holo oa node ea sefate sa binary" e re o fuoa sefate sa binary le node. Joale re hloka ho fumana moholo-holo oa kth ena. Moholo-holo oa node efe kapa efe ke li-node tse tseleng e tsoang motso ...

Bala haholoanyane

Potso ea 418. Inorder Mohlahlami oa node ho Binary Tree Polelo ea Bothata Bothata bo kopa ho fumana "Inorder mohlahlami oa node ho Binary Tree". Mohlahlami oa mohlahlobi oa node ke noute sefateng sa binary se tlang kamora node e fanoeng tseleng e kenelletseng ea sefate sa binary se fanoeng. Mohlala mohlahlami oa mohlahlami oa 6 ke 4 ...

Bala haholoanyane

Potso ea 419. 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 420. Theha Binary Tree ho tsoa ho boemeli bo fanoeng ba Parent Array Bothata "Construct Binary Tree from fanoe ka setšoantšo sa Parent Array" bo re o fuoe lethathamo. Lethathamo lena la ho kenya le emela sefate sa binary. Hona joale o hloka ho aha sefate sa binary motheong oa sehlopha sena sa ho kenya. Sehlopha se boloka index ea node ea motsoali ho index ka 'ngoe. ...

Bala haholoanyane

Potso ea 421. Ha u fuoa sefate sa binary, u tlosa li-node tsohle tsa halofo joang? Bothata "Ha u fuoa sefate sa binary, u tlosa li-node tsohle tsa halofo joang?" e bolela hore o fuoa sefate sa binary. Hona joale o hloka ho tlosa li-node tsa halofo. Node ea halofo e hlalosoa e le noutu sefateng e nang le ngoana a le mong feela. Ekaba ke ...

Bala haholoanyane

Potso ea 422. Iterative Preorder Traversal Bothata ba "Iterative Preorder Traversal" bo bolela hore o fuoe sefate sa binary mme joale o hloka ho fumana tšela pele ea sefate. Re kopuoa ho fumana preorder traversal re sebelisa mokhoa oa iterative eseng mokhoa o ipheta-phetang. Mohlala 5 7 9 6 1 4 3 ...

Bala haholoanyane

Potso ea 423. Fumana sebaka lipakeng tsa li-node tse peli tsa Sefate sa Binary Polelo ea Bothata Bothata "Fumana sebaka lipakeng tsa li-node tse peli tsa Sefate sa Binary" e re o fuoa sefate sa binary mme o fuoa li-node tse peli. Joale o hloka ho fumana sebaka se tlase pakeng tsa li-node tsena tse peli. Mohlala // Sefate se bonts'oa ho sebelisa setšoantšo se kaholimo ho node 1 ...

Bala haholoanyane

Potso ea 424. Ngola Khoutu ho tseba haeba Lifate tse peli li ts'oana Bothata "Ngola Khoutu ea ho tseba hore na Lifate tse peli li ts'oana joang" e re o fuoe lifate tse peli tsa binary. fumana hore na lia tšoana kapa che? Mona, sefate se ts'oanang se bolela hore lifate tsa binary ka bobeli li na le boleng ba node e tšoanang ka tlhophiso e tšoanang ea li-node. Mohlala Lifate ka bobeli ...

Bala haholoanyane

Potso ea 425. Moeli Ho parola sefate sa binary Polelo ea Bothata Bothata "Ho tsamaea moeling oa sefate sa binary" ho bolela hore o fuoa sefate sa binary. Joale o hloka ho printa pono ea moeli oa sefate sa binary. Mona ho parola moeli ho bolela hore li-node tsohle li bontšoa e le moeli oa sefate. Li-node li bonoa ho tsoa ...

Bala haholoanyane

Potso ea 426. Ho Tsamaea ka Tsela e Kopaneng ea Sefate sa Binary Polelo ea Bothata Bothata "Ho Tsamaea ka Tsela e Kopaneng ea Sefate sa Binary" e re o fuoe sefate sa binary mme joale o hloka ho fumana pono e kopaneng bakeng sa sefate se fanoeng. Ha re bona sefate ho tloha lehlakoreng le holimo le letona. Li-node tse bonahalang ho rona ke pono e kopaneng ...

Bala haholoanyane

Potso ea 427. Pono e tlase ea Sefate sa Binary Polelo ea Bothata Bothata "Pono e tlase ea Sefate sa Binary" e re o fuoe sefate sa binary mme joale o hloka ho fumana pono e tlase ea sefate se fanoeng. Ha re bona sefate ho tloha ntlheng e tlase. Li-node tse bonahalang ho rona ke tlase ...

Bala haholoanyane

Potso ea 428. 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 429. Lipotso tse fapaneng tsa LCM Polelo ea Bothata Bothata "Range LCM Queries" bo re o na le lenane le kopaneng la lipotso. Potso ka 'ngoe e na le (ho le letšehali, ka ho le letona) e le bophara. Mosebetsi o fanoeng ke ho fumana LCM (ka ho le letšehali, ka ho le letona), ke hore, LCM ea nomoro eohle e tlang ka bongata ba ...

Bala haholoanyane

Potso ea 430. Fumana palo e phahameng ea boemo ba Binary Tree Polelo ea Bothata Bothata "Fumana palo e kahodimodimo ea Boemo ho Binary Tree" e re o fuoe sefate sa binary se nang le li-node tse ntle le tse mpe, fumana palo e phahameng ea sekhahla sefateng sa binary. Tlatsetso ea Mohlala 7 Tlhaloso ea Pele: Kakaretso = 5 Lekala la Bobeli: Sum = ...

Bala haholoanyane

Potso ea 431. Selelekela sa Sefate se Sefubelu Sefate se sefubelu se sefubelu ke sefate sa binary se itekanyang. Sefateng sena, node e 'ngoe le e' ngoe e ka ba node e khubelu kapa node e ntšo. Kenyelletsong ena ea Sefate se Lefubelu, re tla leka ho koahela litšobotsi tsohle tsa eona tsa mantlha. Properties of Red-Black Tree Node e ngoe le e ngoe e emeloa e le khubelu kapa e ntšo. ...

Bala haholoanyane

Potso ea 432. Binary Search Tree Delete Ts'ebetso Polelo ea Bothata Bothata "Ts'ebetso ea Binary Search Tree Delete" e re kopa ho kenya tšebetsong ts'ebetso ea Delete bakeng sa sefate sa lipatlisiso tsa binary. Delete function e bua ka ts'ebetso ea ho hlakola node ka senotlolo / data e fanoeng. Node ea Input ea Mohlala e lokela ho hlakoloa = Mokhoa oa ho tsoa oa 5 bakeng sa Binary Search Tree Delete Operation Ka hona ...

Bala haholoanyane

Potso ea 433. 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 434. Tšoaea Sefate sa Binary se nang le Lintlha tse sa Lebelloang Polelo ea Bothata U fuoa sefate se felletseng sa binary se nang le lits'oants'o tse sa reroang. Lits'oants'o tse sa lebelloang ho buuoa ka li-node tseo node e 'ngoe le e' ngoe e li supang ntle le ngoana oa eona oa leqele le letona. Kahoo, sena se boetse se fetola sebopeho se tloaelehileng sa node sefateng se bonolo sa binary. Joale node ea ...

Bala haholoanyane

Potso ea 435. Tsamaiso ea maemo e tsamaea ka mela e 'meli Polelo ea Bothata Bothata "Ho otlolla maemo ho sebelisa mela e 'meli" ho re o fuoe sefate sa binary, hatisa tatellano ea sona ea tatellano ka tatellano. Mehlala Keketso 5 11 42 7 9 8 12 23 52 3 Keletso 1 2 3 4 5 6 Algorithm ea Level Order Traversal ...

Bala haholoanyane

Potso ea 436. 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 437. Lekola hore na sehlopha se fanoeng se ka emela Phallo ea Level Order ea Binary Search Tree Polelo ea Bothata Bothata "Hlahloba hore na sehlopha se fanoeng se ka emela Level Order Traversal of Binary Search Tree" se bolela hore o fuoe tatellano ea maemo ho parola sefate sa lipatlisiso. Le ho sebelisa tatellano ea maemo a sefate. Re hloka ho fumana hantle hore na tatellano ea boemo ...

Bala haholoanyane

Potso ea 438. Palo ea banab'eso ba Node e fanoeng ho n-ary Tree Polelo ea Bothata Bothata "Palo ea banab'eno ba Node e fanoeng ho n-ary Tree" e re o fuoa sefate sa n-ary le node ea sepheo. Fumana palo ea banab'eno ba node e lebisitsoeng. Nka hore node e lula e le teng sefateng 'me ntlha ea pele ke ...

Bala haholoanyane

Potso ea 439. Fetolela BST hore e be Min-Heap ntle le ho sebelisa sehlopha Polelo ea Bothata "Fetolela BST hore e be Min-Heap ntle le ho sebelisa sehlopha" bothata bo re o fuoe BST (sefate sa lipatlisiso tsa binary) mme o hloka ho e fetola qubu ea min. Qubu ea min e lokela ho ba le likarolo tsohle tsa sefate sa patlo sa binary. Algorithm e lokela ho sebetsa ka mokhoa o rarahaneng oa nako. ...

Bala haholoanyane

Potso ea 440. Kopanya li-BST tse peli tse nang le sebaka se fokolang Polelo ea Bothata Bothata "Kopanya li-BST tse peli tse nang le sebaka se fokolang" ho bolela hore o fuoe sefate sa lipatlisiso tsa binary tse peli (BST) mme o hloka ho hatisa likarolo tsa lifate ka bobeli ka tatellano. Ke ka tatellano eo ho bonahalang hore likarolo li tsoa ho BST e le 'ngoe. ...

Bala haholoanyane

Potso ea 441. 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 442. Binary Tree ho Binary Search Tree Phetoho e sebelisang sete ea STL Polelo Bothata Re fuoa sefate sa binary mme re hloka ho se fetola sefate sa lipatlisiso tsa binary. Bothata "Binary Tree to Binary Search Tree Conversion e sebelisa STL set" e kopa ho etsa phetoho o sebelisa STL set. Re se re buile ka ho fetola sefate sa binary hore se be BST empa re ...

Bala haholoanyane

Potso ea 443. K'th e kholo ka ho fetisisa ho BST e sebelisa sebaka se eketsehileng sa kamehla Polelo ea Bothata "K'th element e kholo ka ho fetisisa ho BST e sebelisa sebaka se eketsehileng sa" e bolela hore o fuoe sefate sa patlo sa binary mme o hloka ho fumana karolo ea kth e kholo ho sona. Kahoo haeba re hlophisa likarolo tsa sefate sa patlo sa binary ka tatellano e theohang re tla hloka ho khutla ...

Bala haholoanyane

Potso ea 444. K'th Element e Kholo ho BST ha phetoho ea BST e sa lumelloe Polelo ea Bothata "K'th Largest Element ho BST ha phetoho e sa lumelloe" e re o fuoe sefate sa lipatlisiso tsa binary mme o hloka ho fumana element ea kth e kholo. Sena se bolela hore ha likarolo tsohle tsa sefate sa lipatlisiso tsa binary li hlophisitsoe ka tatellano e theohelang. Ebe ...

Bala haholoanyane

Potso ea 445. 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 446. Hlahloba hore na karolo e 'ngoe le e' ngoe ea ka hare ea BST e na le ngoana a le mong Polelo ea Bothata "Hlahloba hore na node e 'ngoe le e' ngoe ea ka hare ea BST e na le ngoana a le mong" bothata bo re o fuoe ts'ebeliso ea esale pele ea ho batla sefate sa binary. 'Me u hloka ho fumana hore na li-node tsohle tse se nang makhasi li na le ngoana a le mong feela. Mona re boetse re nahana hore ...

Bala haholoanyane

Potso ea 447. Fumana k-th e nyane haholo ho BST (Order Statistics in BST) Polelo ea Bothata "Fumana k-th e nyane haholo ho BST (Order Statistics in BST)" bothata bo re o fuoe sefate sa lipatlisiso tsa binary mme o hloka ho fumana nomoro e nyane ka ho fetisisa ea k-th ho BST. Sena se bolela hore haeba re etsa tšalo-morao ea ho batla sefate sa binary mme re boloka ...

Bala haholoanyane

Potso ea 448. Kakaretso ea sefateng sa sefate sa binary Polelo ea Bothata "Bothata bo hlahang sefateng sa binary" bothata bo re o filoe sefate sa binary mme re hloka ho fumana kakaretso ea boemo ka bong. Ka boemo bo tsepameng, re bolela hore haeba re taka mela e emeng hole le yuniti e 1 ka ho le letšehali le ka ho le letona ...

Bala haholoanyane

Potso ea 449. 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 450. Botebo bo boholo ba Sefate sa Binary Polelo ea Bothata "Botebo bo boholo ba sefate sa binary" bothata bo re o fuoa sebopeho sa data ea sefate sa binary. Hatisa botebo bo boholo ba sefate se fanoeng ka binary. Tlhaloso ea Mohlala 2 Tlhaloso: Botebo bo boholo ba sefate se fanoeng ke 2. Hobane ho na le ntho e le 'ngoe feela ka tlasa motso (ke hore ...

Bala haholoanyane

Potso ea 451. Fetolela BST ho Min Heap Polelo ea Bothata ha u filoe Sefate se Batlang sa Binary, ngola algorithm ho e fetola Qubu ea Min, e leng ho fetola BST ho ea Min Heap. Min Heap e lokela ho ba joalo hore litekanyetso tse ka letsohong le letšehali la node li tlameha ho ba tlase ho litekanyetso tse ka ho le letona ...

Bala haholoanyane

Potso ea 452. Kopanya Lifate tse peli tse leka-lekaneng tsa ho batla tsa Binary Polelo ea Bothata e fuoe Lifate tse peli tse leka-lekaneng tsa ho Batla ka Binary, ho na le likarolo ho BST ea pele le m ho BST ea bobeli. Ngola algorithm ho kopanya lifate tse peli tse leka-lekaneng tsa ho batlisisa ka binary ho etsa mofuta oa boraro oa Binary Search Tree o nang le likarolo tsa (n + m). Mohlala Input Output Pele ho otara ...

Bala haholoanyane

Potso ea 453. Phuputso ea Binary ea Patlo ea Lifate le ho Kenya Polelo ea Bothata Ngola algorithm ho etsa lipatlisiso le ho kenya ho Binary Search Tree. Kahoo seo re tla se etsa ke ho kenya tse ling tsa likarolo ho tloha ho keneng sefateng sa lipatlisiso tsa binary. Nako le nako ha re botsoa ho batla ntho e itseng, re tla e batlisisa har'a likarolo tsa BST (khutšoane ...

Bala haholoanyane

Potso ea 454. Hlahloba boholo ba boholo ba n bo ka emela BST ea maemo kapa ha Polelo ea Bothata Ha u fuoa sehlopha se nang le likarolo, hlahloba boholo ba boholo ba n bo ka emela BST ea maemo kapa ha. Seo ke ho hlahloba hore na sefate sa patlo sa binary se hahiloeng ho sebelisoa li-element tsa n se ka emela BST ea maemo. Mehlala arr [] = {10, 8, 6, 9, ...

Bala haholoanyane

Potso ea 455. 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 456. Lethathamo le hlophisitsoeng le hoketsoeng ho BST e leka-lekaneng Lethathamong le hlophisitsoeng le hlophisitsoeng le bothata bo leka-lekaneng ba BST, re fane ka lenane le le leng le hokahaneng ka tatellano, re aha Balanced Binary Tree ho tsoa lenaneng le le leng le hokahaneng. Mehlala Input 1 -> 2 -> 3 -> 4 -> 5 Output Pre-order: 3 2 1 5 4 Input 7 -> ...

Bala haholoanyane

Potso ea 457. 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 458. Fetola BST ho ea ho Sefate se seholo Ho fetola BST ho ba sefate se seholo ho feta se fanoeng ka Sefate sa Patlo ea Binary ngola algorithm ho e fetolela ho sefate se seholo ho feta, ke hore, fetola node ka 'ngoe hore e be le kakaretso ea likarolo tsohle tse kholo ho feta eona. Tlhahiso-pele ea tlhahiso ea mohlala: 69 81 87 34 54 ...

Bala haholoanyane

Potso ea 459. Melemo ea BST holim'a Tafole ea Hash Ts'ebetso e sebelisoang hangata ho sebopeho sa data ke ho kenya, ho hlakola le ho phenyekolla. Hash Table e khona ho etsa lits'ebetso tsena tse tharo ka ho rarahana ha nako ka karolelano ea O (1), ha ho leka-lekanya Binary Search Lifate ho nka O (log n) ho rarahana ha nako. Qalong, ho bonahala eka Litafole tsa Hash li betere ho feta ...

Bala haholoanyane

Potso ea 460. Theha BST ho tsoa ho eona Order Level Traversal eo e fuoeng Ka lebaka la tatellano ea tatellano ea Binary Search Tree, ngola algorithm ho aha Binary Search Tree kapa BST ho tloha ho eona. Mohlala Input levelOrder [] = {18, 12, 20, 8, 15, 25, 5, 9, 22, 31} Output In-order: 5 8 9 12 15 18 ...

Bala haholoanyane

Potso ea 461. Theha BST ho tsoa ho Preorder Traversal e fuoeng Fuoa ho otara esale pele ho Binary Search Tree (BST), ngola algorithm ho aha BST ho tsoa ho preorder traversal. Mehlala Input preOrder [] = {7, 5, 3, 6, 9} Output Inorder: 3 5 6 7 9 Input preOrder [] = {12, 6, 1, 35, 20} Output Inorder: 1 6 ...

Bala haholoanyane

Potso ea 462. Fumana node ka boleng bo tlase ho Binary Search Tree Ha u fuoa Sefate sa Patlo ea Binary, ngola algorithm ho fumana node ka boleng bo tlase sefateng sa patlo ea binary. Mokgwa wa ho kenya Input Output 5 Naive Approach At mokhoa e bonolo ke ho etsa ho parola sefate ebe o fumana node e nang le boleng bo tlase hara li-node tsohle. Sena ...

Bala haholoanyane

Potso ea 463. Theha Sefate sa Binary ho Tsoa ho Inorder Inorder le Preorder Traversals Bothateng bona, re hlophisitse le ho hlophisa pele ho sefate sa binary. Re hloka ho aha sefate sa binary ho tsoa litselaneng tse fanoeng tsa Inorder le Preorder. Ho Kena ha Mohlala: Inorder = [D, B, E, A, F, C] Preorder = [A, B, D, E, C, F] Sephetho: Pele ho tšela sefate se entsoeng ke ...

Bala haholoanyane

Potso ea 464. Hatisa Baholo-holo ba Node ea Sefate sa Binary e Fuoeng Ntle le Ho Khutlela Fuoa sefate sa binary le node kapa senotlolo se ikhethileng. Hatisa baholo-holo ba node ea sefate ea binary ntle le ho ipheta. Mohlala Input: key = 7 Output: 3 1 Input: key = 4 Output: 2 1 Algorithm for Ancestors of a Given Binary Tree Node Create a class Node ...

Bala haholoanyane

Potso ea 465. 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 466. Kth Element e Nyane ho BST Bothateng bona, re fane ka BST le nomoro k, re fumane karolo ea kth e nyane ho BST. Mehlala Sefate sa Keletso [] = {5, 3, 6, 2, 4, null, null, 1} k = 3 Output 3 Sefate sa ho kenya [] = {3, 1, 4, null, 2} k = 1 Output 1. ..

Bala haholoanyane

Potso ea 467. E leka-lekaneng Binary Tree Bothateng bo leka-lekaneng ba sefate sa binary, re file motso oa sefate sa binary. Re tlameha ho tseba hore na ke bophahamo ba bolelele kapa che. Mehlala Kengo Khumo Keketso ea 'Nete Keletso: bohata Balanced Binary Tree Node e ngoe le e ngoe sefateng se leka-lekaneng sa binary e na le phapang ea 1 kapa ka tlase ...

Bala haholoanyane

Potso ea 468. Sefate sa karohano Mathateng a sefate, re fane ka letoto la linako le mefuta e meraro ea lipotso addInterval (x, y): Eketsa karohano (x, y) ho set set removeInterval (x, y): Tlosa karohano (x, y) ) ho tsoa ho sete checkInterval (x, y): Lekola hore na karohano (x, y) e kopana le nako e seng e ntse e le teng Rala sebopeho sa data (Interval Tree) ...

Bala haholoanyane

Potso ea 469. Theha Sefate sa Binary se Felletseng ho tsoa ho Boemeli ba Lenane la Ts'ebeliso Ho fanoe ka lenane le hokahaneng le emelang sefate se felletseng sa binary. Lethathamo le hokahaneng le ka tatellano ea tatellano ea maemo ho haola sefate. Ngola algorithm ho aha sefate se felletseng sa binary ho tloha ho lenane la sona le hokahaneng. Ho kenya mohlala 1 -> 2 -> 3 -> 4 -> 5 ...

Bala haholoanyane

Potso ea 470. 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 471. Baholo-holo ba Tloaelehileng ka ho Fetisisa ho Binary Search Tree Fuoa motso oa sefate sa patlo sa binary le li-node tse peli n1 le n2, fumana LCA (Lowest Common Ancestor) ea li-node sefateng se fanoeng sa binary search. Mohlala oa Boikarabello bakeng sa Boholo-holo bo Tloaelehileng ka ho Fetisisa ho Binary Search Tree Fumana LCA (n1, n2) u sebelisa mokhoa o nepahetseng oa ho fumana LCA ...

Bala haholoanyane

Potso ea 472. Karolo ea Karolo Haeba re etsa tlatsetso lethathamong le fanoeng la likarolo tsa boleng ba tsona bo ntlafalitsoeng nako efe kapa efe. Joale bothateng ba mofuta oo, re sebetsana le sebopeho sa sefate. Fuoa letoto la [] le likarolo tsa n 'me u tlameha ho araba lipotso tse ngata, e' ngoe le e 'ngoe ea lipotso ke e le' ngoe ...

Bala haholoanyane

Potso ea 473. Hatisa Sefate sa Binary ka Vertical Order Bothateng bona, re fane ka sesupi se supang motso oa sefate sa binary mme mosebetsi oa hau ke ho hatisa sefate sa binary ka tatellano e otlolohileng. Mohlala Input 1/2 3 / / / 4 5 6 7 \ 8 9 Khumo 4 2 ...

Bala haholoanyane

Potso ea 474. Sefate sa Patlo ea Binary Sefate sa lipatlisiso tsa binary ke sefate sa Binary se nang le melao e meng e re lumellang ho boloka lintlha ka mokhoa o hlophisitsoeng. Joalo ka ha e le sefate sa binary ka hona, node e ka ba le bana ba max 2. Sebopeho sa Melao ea nalane ea Sefate sa Binary Search bakeng sa sefate sa Binary ho ...

Bala haholoanyane

Potso ea 475. Palo e kahodimodimo ea Binary Tree Bothateng bona, re fane ka lenane le boholo ba []. Theha sefate se phahameng ka ho fetesisa ho tloha sehlopheng ebe o khutlisa motso oa sona oa motso. E entsoe ka sehlopha ka ho sebelisa mehato e latelang: Motso oa sefate e lokela ho ba boleng bo holimo ho se fanoeng ...

Bala haholoanyane

Potso ea 476. 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 477. Fumana Sefate sa Patlo ea Binary Nahana ka sefate sa patlo sa binary, li-node tse peli tsa sefate li fapantsoe, rala algorithm ho khutlisa sefate sa patlo sa binary. Mohlala Nahana ka sefate sa patlo sa binary se fanoeng ka tlase seo li-node tsa sona tse peli li fetotsoeng ho kenya. Li-node tse fosahetseng ho BST lia fumanoa (li totobalitsoe) ebe li fapanyetsanoa ho fumana ...

Bala haholoanyane

Potso ea 478. Ho hlahisa lintlha tse latelang ka ho le letona Node ka 'ngoe Ha u fuoa Sefate sa Binary, hokela li-node tse maemong a ts'oanang ho tloha ho le letšehali ho ea ho le letona. Sebopeho sa Node ea Sefate: Node ea sefate e na le likarolo tse 4 e leng data (palo e kholo), litsupa (tse latelang, ho le letšehali le ka ho le letona) tsa mofuta oa node ea sefate. sesupi se latelang sa ntlha ea node e lebileng ho eona ...

Bala haholoanyane

Potso ea 479. Pono e holimo ea Sefate sa Binary Ponahalo e kaholimo ho sefate sa binary ke sete sa li-node tse bonahalang ha sefate se bonoa ho tloha holimo. Ha ho fanoa ka sefate sa binary, pono e hlahisoang ka holimo ea sefate sa binary ho tloha boemong ba leqele-ho le letshehadi ho fihla boemong bo otlolohileng. Mohlala Mohlala 1 Mohlala 2 Mefuta ya ...

Bala haholoanyane

Potso ea 480. Boemo ba noutu ka 'ngoe sefateng ho tloha node ea mohloli Ha ho fanoa ka sefate (graph ea acyclic e hokahantsoeng ka botlalo moo li-node tse hokahaneng li hokahantsoeng ke likarolo tse habeli) le node ea mohloli. fumana boemo ba ntlha e ngoe le e ngoe ka node ea mohloli oa sefate. Ho fanoe ka hore boemo ba node v mabapi le mohloli ke sebaka se pakeng tsa ...

Bala haholoanyane

Potso ea 481. Fumana likopi tse tlase Likopi tsa Subtrees Subtrees ho boleloa hore li ka kopitsoa haeba li na le litekanyetso le sebopeho sa node. Fuoa sefate sa binary se nang le li-node. Fumana li-subtrees tsohle tse kopilitsoeng ebe u khutlisa motso oa bona oa motso. Mohlala Mona, litlatsetso tsa 4 le 2-> 4 li hlaha hangata ho feta hanngoe ka hona re tla khutlisa motso ...

Bala haholoanyane

Potso ea 482. 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 483. 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 484. Fetolela Lenane le hlophisitsoeng ho Sefate sa Lipatlisiso sa Binary Bothata bo Filoe lenane le hokahaneng. Lintlha tsa lenane le hokahaneng li ntse li eketseha ka tatellano. Fetolela lethathamo le fanoeng le hokahanngoeng hore e be sefate sa patlo sa binary se leka-lekaneng haholo. Sefate sa patlo ea binary e leka-lekaneng haholo ke sefate sa lipatlisiso tsa binary moo phapang lipakeng tsa botebo ba likarolo tse peli tsa eng kapa eng ...

Bala haholoanyane

Potso ea 485. Netefatsa Sefate sa Patlo ea Binary Bothata ba ho netefatsa Binary Search Tree bothata boo re bo fileng motso oa sefate, re tlameha ho sheba hore na ke sefate sa lipatlisiso tsa binary kapa che. Mohlala: Phatlalatso: Tlhaloso ea 'nete: Sefate se fanoeng ke sefate sa patlo sa binary hobane likarolo tsohle tse setseng ho karoloana e ngoe le e ngoe ...

Bala haholoanyane

Potso ea 486. Tsela ea Sum Bothata ba Path Sum ke eng? Bothateng ba Path Sum, re file sefate sa binary le SUM e felletseng. Re tlameha ho fumana hore na tsela efe kapa efe ho tloha motso ho ea ho lekhasi e na le chelete e lekanang le SUM. Kakaretso ea tsela e hlalosoa e le kakaretso ea li-node tsohle ...

Bala haholoanyane

Potso ea 487. Tsela ea ho Tsamaea ha Binary Tree Level Order Traversal ea sefate se fanoeng sa binary e ts'oana le BFS ea sefate sa binary. Na re se re ntse re tseba hore na haele hantle BFS ke eng? Haeba ho se joalo ha ho hlokahale hore u utloe bohloko bala feela sengoloa sohle 'me u etele lingoliloeng tsa rona tse fetileng bakeng sa kutloisiso e betere. BFS ke ...

Bala haholoanyane

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

Potso ea 489. Ho tlosoa Sefateng sa Binary Na re se re ntse re tseba hore na haele hantle Binary Tree ke eng? Joale posong ena, re shebane le mokhoa oa ho hlakola node eo boleng ba eona bo fanoeng. Re na le bonnete ba hore boleng ba node eo re batlang ho e hlakola bo lula bo le teng pele e tlosoa ho BT. Ka Binary ...

Bala haholoanyane

Potso ea 490. Lifate tse ikhethang tsa ho Batla ka Binary Pele re tlameha ho fumana palo e felletseng ea lipalo ho theha sefate se ikhethileng sa patlo ea binary. Ka mor'a eona, re aha tsohle tse ka khonehang tsa BST. Pele, re tlameha ho tseba kaho ea BST. Sefateng sa Binary Search, li-node tse teng ka lehlakoreng le letšehali la subtt. eng kapa eng ...

Bala haholoanyane

Potso ea 491. BFS vs DFS bakeng sa Sefate sa Binary Breadth First Search (BFS) Na re se re ntse re tseba hore na haele hantle BFS ke eng? Haeba ho se joalo ha ho hlokahale hore u utloe bohloko bala feela sengoloa sohle ebe u etela sengoloa sa rona se fetileng ho Breadth First Search bakeng sa kutloisiso e betere. BFS ke tatellano ea tatellano eo re etelang libaka tsa ...

Bala haholoanyane

Lipotso tsa Graph tsa Amazon

Potso ea 492. Fumana Tharollo ea Leetcode ea Moahloli oa Toropo Polelo ea Bothata Bothateng bona, re fuoa batho ba ngoliloeng ho tloha ho 1 ho isa ho n. Re boetse re filoe 2d array trust [] [] e bonts'a hore trust [i] [0] th people trust trust [i] [1] th people for each 0 <= i <trust.length. Re tlameha ho fumana motho "moahloli oa toropo" ea sa tšepeng mang kapa mang ...

Bala haholoanyane

Potso ea 493. Fumana linomoro tse nyane ka ho fetesisa tsa linomoro tse fanoeng Polelo ea Bothata Bothata "Fumana linomoro tse nyane ka ho fetesisa tsa palo e fanoeng" e re o filoe nomoro ea decimal N. Kahoo fumana linomoro tse nyane haholo tsa N tse nang le linomoro tsa '0' le '1' feela. Mohlala 37 111 Tlhaloso e qaqileng e ka fumanoa ka tlase ho ...

Bala haholoanyane

Potso ea 494. Ts'ebetso e nyane ea ho fetolela X ho Y Polelo ea Bothata Bothata "Ts'ebetso e nyane ea ho fetolela X ho Y" e re o fuoe linomoro tse peli X le Y, ho hlokahala hore o fetole X ho Y ho sebelisa ts'ebetso e latelang: Ho qala nomoro ke X. Ho latela ts'ebetso ho ka etsoa ka X le ho ea pele. linomoro tse hlahisoang ...

Bala haholoanyane

Potso ea 495. Lekola hore na li-node tse peli li tseleng e le 'ngoe Sefateng Polelo ea Bothata Bothata "Hlahloba hore na li-node tse peli li tseleng e le 'ngoe Sefateng" e re u fuoe sefate sa n-ary (se tataisitsoeng ka acyclic graph) se metseng ka metso mothapong o nang le mahlakore a lipakeng tsa sona. U fuoa lethathamo la lipotso q. Potso ka 'ngoe e lenaneng ...

Bala haholoanyane

Potso ea 496. Sebaka sa sele e haufinyane e nang le 1 ka popalo ea binary Polelo ea Bothata Bothata "Sebaka sa sele se haufi se nang le 1 ka popalo ea binary" se re o fuoa matrix ea binary (e nang le 0s le 1s feela) bonyane 1 e le ngoe. Fumana sebaka sa sele e haufinyane e nang le 1 matrix ea binary bakeng sa likarolo tsohle tsa ...

Bala haholoanyane

Potso ea 497. Transpose Kerafo Polelo ea Bothata Bothata "Transpose graph" e re o fuoe graph mme o hloka ho fumana phetoho ea graph e fanoeng. Transpose: Transpose ea graph e tataisitsoeng e hlahisa graph e ngoe e nang le li-configurations tsa bohale le li-node empa tataiso ea likhahla tsohle e fetohile. Mohlala ...

Bala haholoanyane

Potso ea 498. BFS bakeng sa Kerafo e sa Amoheloang Polelo ea Bothata Bothata "BFS bakeng sa Kerafo e sa Amoheloang" e re o fuoe kerafo e laolitsoeng e sa sebetsoang, hatisa tsela ea BFS ea graph. Mohlala Ho haola BFS kerafo e kaholimo ho fana ka: 0 1 2 5 3 4 6 Atamela tsela ea Breadth first Search (BFS) ea Kerafo e Laolitsoeng e sa Ameng ...

Bala haholoanyane

Potso ea 499. Mehato e Monyane ea ho fihlela sepheo ke Knight Tlhaloso Bothata "Mehato e Monyane ea ho fihlela sepheo ke Knight" e re o filoe boto ea lisekoere ea chess ea litekanyo tsa N x N, likhokahano tsa sengoathoana sa Knight, le sele e shebiloeng. Fumana palo e tlase ea mehato e nkuoeng ke sengoathoana sa Knight ho fihlela sepheo ...

Bala haholoanyane

Potso ea 500. Botebo ba ho qala bo tebileng ho tloha ho Iterative Boemong ba ho pheta-pheta ha mathata a graph, re fane ka sebopeho sa data sa graph. Ngola lenaneo ho hatisa botebo ba ho qala kerafo e fanoeng u sebelisa mokhoa oa iterative. Ho kenya mohlala: 0 -> 1, 0 -> 2, 1 -> 2, 2 -> 0, 2 -> 3, 3 ...

Bala haholoanyane

Potso ea 501. Lekola Karolo Ha re lekola bothata ba karohano re fane ka li-equations, ka sebopeho, A / B = k, moo A le B e leng likhoele mme k ke palo ea nnete. Araba lipotso tse ling, haeba karabo e le sieo khutla -1. Ho kenya mohlala: li-equations: a / b = 2.0 le b / c = lipotso tsa 3.0: a / c ...

Bala haholoanyane

Potso ea 502. Algorithm ea Prim Algorithm ea Prim e sebelisetsoa ho fumana Minimum Spanning Tree (MST) ea graph e hokahaneng kapa e sa lebisoang. Sefate sa Spanning sa graph ke karoloana eo hape e leng sefate 'me e kenyelletsa mahlakore ohle. Minimum Spanning Tree ke sefate se otlolohileng se nang le bokaalo bo tlase ba boima ba 'mele. Mohlala oa Bonyane ba Graph ...

Bala haholoanyane

Potso ea 503. Sebaka sa Max Island Tlhaloso ea Bothata: Ha ho fanoa ka matrix a 2D, matrix e na le 0 feela (e emelang metsi) le 1 (e emelang mobu) joalo ka litlatsetso. Sehlekehleke se matrix se theoa ka ho hlopha lihlopha tsohle tse haufinyane tsa 1 tse hokahantsoeng ka 4 (ka mokhoa o otlolohileng le o otlolohileng). Fumana sebaka se phahameng sa sehlekehleke ka har'a matrix. Nka hore likarolo tsohle tse 'ne tsa ...

Bala haholoanyane

Potso ea 504. Cloning ea graph Graph Cloning ke eng? Kajeno re na le re bua ka graph e sa lebisoang. Re tlameha ho etsa eng? Ho khutlisa kopi e tebileng ea graph e fanoeng. Ha re shebeng sebopeho: Node ea Sehlopha: E na le boleng ba data le baahisani ba amanang le e ngoe le e ngoe ...

Bala haholoanyane

Potso ea 505. Ho hlophisa lihlooho Ha u fuoa graph ea acyclic e tataisitsoeng, ka tatellano u ka hlopha li-node tsa graph. Mohlala oa ho Hlopha ka Sehloho sa Topological Ho hlophisa ka holimo ho graph e kaholimo ke -> {1,2,3,0,5,4} Khopolo ea Topological Sorting e etsoa bakeng sa Directed Acyclic Graph (DAG). DAG ha e na lipotoloho ho eona. ke hore, ha ho na tsela e joalo ho tloha node efe kapa efe ea ...

Bala haholoanyane

Potso ea 506. Breadth First Search (BFS) ea Kerafo Breadth First Search (BFS) ea graph ke algorithm e haolang kapa e batlisisang sebopeho sa data ea sefate / graph. E qala ho vertex e fuoeng (vertex efe kapa efe e hatellang) mme e hlahloba vertex eohle e hokahaneng mme kamora moo e fetela ho vertex e haufi mme e lekola li-node tsohle tse sa hlahlojoang mme e hlokomela hore ha ho ...

Bala haholoanyane

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

Amazon Stack Lipotso

Potso ea 508. 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 509. 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 510. 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 511. Rala Stack ka Keketso ea Ts'ebetso ea Leetcode Tharollo Polelo ea Bothata Moralo oa Stack With Keketso Operation Leetcode Solution - e re re hloka ho rala stack e ts'ehetsang ts'ebetso e ka tlase ka nepo. Abela boholo ba bokhoni ba stack. Etsa ts'ebetso ea push hantle, haeba boholo ba stack bo le tlase haholo ho feta boholo ba matla a ...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 513. Next Greater Element Ke Leetcode Tharollo Polelo ea Bothata Bothateng bona, re fuoa manane a mabeli ao lenaneng la pele e leng subset ea lenane la bobeli. Bakeng sa ntlha ka 'ngoe ea lenane la pele, re tlameha ho fumana lintlha tse latelang tse kholo lenaneng la bobeli. Mohlala nums1 = [4,1,2], nums2 = [1,3,4,2] [-1,3, -1] Tlhaloso: bakeng sa ntlha ea pele ea lenane1 ke hore bakeng sa 4 moo ...

Bala haholoanyane

Potso ea 514. 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 515. Nomoro ea bonyane ba foromo ho latela tatellano e fanoeng Bothata "Fomoro palo e nyane ho latela tatellano e fanoeng" e re o fuoe mohlala oa nna le oa D feela. Moelelo oa Ke emela ho eketseha le ho fokotseha re fuoang D. Setatemente sa bothata se kopa ho hatisa palo e nyane e khotsofatsang paterone e fanoeng. Re na le ...

Bala haholoanyane

Potso ea 516. Lipotso tse fapaneng bakeng sa ho latela nako e telele ka ho fetisisa ea bracket U fuoa tatellano ea li-brackets tse latelang, ka mantsoe a mang, u fuoa li-brackets tse kang '(' le ')' 'me u fuoa lethathamo la lipotso e le qalo le sebaka sa ho qetela. Bothata "Range Queries for Longest Correct Bracket" e botsa ho fumana bolelele bo phahameng ...

Bala haholoanyane

Potso ea 517. 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 518. 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 519. Hlophisa spongebob ka ho ipheta Polelo ea Bothata Bothata "Hlopha mothapo ka ho ipheta" e re o fuoe sebopeho sa pokello ea lintlha. Hlophisa likarolo tsa eona ka ho ipheta. Ke mesebetsi e thathamisitsoeng ka tlase feela ea `` stack '' e ka sebelisoang - Push (element) - ho kenya setho mokoting. pop () - pop () - ho tlosa / hlakola ...

Bala haholoanyane

Potso ea 520. Hlakola ntlha e bohareng ea spongebob Polelo ea Bothata e filoe sebopeho sa data (pokello). Ngola lenaneo ho hlakola karolo e bohareng ea mokotla o fanoeng u sebelisa mesebetsi ea mantlha ea sethala - Push () - ho kenya ntho ka har'a mokotla pop () - ho tlosa / ho hlakola ntho e kaholimo ho stack. empty () - ho hlahloba ...

Bala haholoanyane

Potso ea 521. Ho hlophisa mefuta e mengata ho sebelisoa mekotla Polelo ea bothata Bothata "Ho hlophisa mefuta e mengata ho sebelisoa mekotla" e re o fuoe moralo oa sebopeho sa data [] ea boholo n. Hlophisa likarolo tsa sehlopha se fanoeng o sebelisa sebopeho sa data. Mohlala 2 30 -5 43 100 -5 2 30 43 100 Tlhaloso: The element e hlophisitsoe ka ...

Bala haholoanyane

Potso ea 522. Hlopha thoto ka ho sebelisa pokotho ea nakoana Polelo ea Bothata Bothata "Hlophisa mothapo o sebelisa pokello ea nakoana" e re o fuoe sebopeho sa pokello ea lintlha. Hlophisa likarolo tsa mokoa o fuoeng o sebelisa pokello ea nakoana. Mohlala 9 4 2 -1 6 20 20 9 6 4 2 -1 2 1 4 3 6 5 ...

Bala haholoanyane

Potso ea 523. Fetolela mantsoe ka bomong Polelo ea Bothata Bothata "Ho fetola mantsoe ka bomong" ho bolela hore u fuoe khoele s. Hona joale, hatisa setšoantšo sa mantsoe ka bomong ka khoeleng. Mohlala s = "TutorialCup - ho fetola tsela ea ho ithuta" puClairotuT - gnignahc eht yaw fo gninrael s = "Ho fetola mantsoe ka bomong" esreveR ...

Bala haholoanyane

Potso ea 524. 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 525. Kenya tšebetsong setoko u sebelisa lethathamo le le leng Polelo ea Bothata Bothata "Kenya ts'ebetsong setoko ka ho sebelisa lethathamo le le leng" e re kopa ho kenya tšebetsong sebopeho sa data sa stack (LIFO) re sebelisa mokoloko oa data (FIFO). Mona LIFO e bolela Last In First Out ha FIFO e bolela First In First Out. Mohlala sutumetsa (10) sutumetsa (20) holimo () pop () sutumelletsa (30) pop () holimo () Holimo: 20 ...

Bala haholoanyane

Potso ea 526. Hlahloba hore na lethathamo le ka hlophisoa moleng o mong ho sebelisoa stack Polelo ea Bothata Bothata "Hlahloba hore na mola o ka hlophisoa moleng o mong o sebelisa pokello" o re o fuoe lethathamo le nang le li-elemente, likarolo tse molaong ke tumello ea linomoro 1 ho isa ho n. Lekola hore na lethathamo lena le ka hlophisoa ka tatellano e ntseng e eketseha ...

Bala haholoanyane

Potso ea 527. Foromo e nyane ea Foromo ho latela tatellano e fanoeng Polelo ea Bothata Bothata "Foromo e Nyane ea Fomu ho Tloha ho tatellano e fanoeng e re o fuoe khoele ea bolelele / boholo n e emelang sebopeho sa litlhaku 'I' ke hore ho eketsa le 'D' ke ho fokotseha feela. Hatisa palo e tlase bakeng sa paterone e fanoeng ka linomoro tse ikhethileng ho tloha ho 1-9. Mohlala - ...

Bala haholoanyane

Potso ea 528. 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 529. Litumello tsa Stack (Lekola hore na lethathamo ke tumello ea tse ling) Polelo ea Bothata Bothata "Litumello tsa Stack (Hlahloba hore na lethathamo ke tumello ea tse ling)" e re o fuoe lihlopha tse peli a [] le b [] ea boholo n. Lintlha tsohle tsa sehlopha li ikhethile. Etsa mosebetsi ho netefatsa hore na sehlopha se fanoeng b [] ke ...

Bala haholoanyane

Potso ea 530. 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 531. Theha BST ho tsoa ho Preorder Traversal e fuoeng Fuoa ho otara esale pele ho Binary Search Tree (BST), ngola algorithm ho aha BST ho tsoa ho preorder traversal. Mehlala Input preOrder [] = {7, 5, 3, 6, 9} Output Inorder: 3 5 6 7 9 Input preOrder [] = {12, 6, 1, 35, 20} Output Inorder: 1 6 ...

Bala haholoanyane

Potso ea 532. Hatisa Baholo-holo ba Node ea Sefate sa Binary e Fuoeng Ntle le Ho Khutlela Fuoa sefate sa binary le node kapa senotlolo se ikhethileng. Hatisa baholo-holo ba node ea sefate ea binary ntle le ho ipheta. Mohlala Input: key = 7 Output: 3 1 Input: key = 4 Output: 2 1 Algorithm for Ancestors of a Given Binary Tree Node Create a class Node ...

Bala haholoanyane

Potso ea 533. Fumana Boholo ba Bonyane bakeng sa Boholo ba Window e 'ngoe le e' ngoe ka tatellano e fanoeng Ha ho fanoa ka bongata ba [] boholo ba n. Bakeng sa boholo bo bong le bo bong ba fensetere bo fapaneng ho tloha ho 1 ho isa ho n ka ho hatisoa ka bongata kapa ho fumana bonyane bo fokolang bakeng sa boholo ba fensetere e ngoe le e ngoe ka tatellano e fanoeng Keletso ea Mohlala: a [] = {10, 20, 30, 50, 10, 70, 30} Sephetho: 70 30 20 ...

Bala haholoanyane

Potso ea 534. Botebo ba ho qala bo tebileng ho tloha ho Iterative Boemong ba ho pheta-pheta ha mathata a graph, re fane ka sebopeho sa data sa graph. Ngola lenaneo ho hatisa botebo ba ho qala kerafo e fanoeng u sebelisa mokhoa oa iterative. Ho kenya mohlala: 0 -> 1, 0 -> 2, 1 -> 2, 2 -> 0, 2 -> 3, 3 ...

Bala haholoanyane

Potso ea 535. Bonyane ba Bracket bo fetoha Bothateng bo tlase ba phetoho ea bracket, re file likhoele tse nang le polelo ea '{' le '}' feela. Fumana palo e nyane ea ho fetoha ha bracket e hlokahalang ho etsa hore polelo e leka-lekane. Mohlala Input: s = “} {” Output: 2 Input: s = “{{{” Output: The expression expression is not ...

Bala haholoanyane

Potso ea 536. Polelo e na le bracket e sa hlokeheng kapa che Ho fanoe ka khoele s e nang le polelo ea li-opareitara, li-operand le li-parenthesis. Fumana hore na khoele e fanoeng e na le masakana a sa hlokahaleng ntle le moo polelo e ntseng e tla fana ka sephetho se ts'oanang. Ka mantsoe a mang, re tlameha ho fumana polelo eo e na le bracket e sa hlokeheng kapa che. Bracket e sa Hlokeheng Haeba e ...

Bala haholoanyane

Potso ea 537. Lekola hore na lipolelo tse peli tse nang le libakete li ts'oana Ho fanoe ka likhoele tse peli s1 le s2 tse emelang lipolelo tse nang le sesebelisoa sa tlatsetso, sesebelisoa sa ho tlosa, lialfabeta tse nyane le li-parenthesis. Lekola hore na lipolelo tse peli tse nang le masakaneng lia tšoana. Mohlala Input s1 = “- (a + b + c)” s2 = “-abc” Tlhahiso Ee Keketso s1 = “ab- (cd)” s2 = “abcd” Output No Algorithm ho Lekola hore na e 'Meli ...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 540. 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 541. Tlhatlhobo ea Tlhaloso ea Arithmetic Re ngola lipolelo tsa Arithmetic ka ho latela lintlha tse tharo - Lethathamo la Sehlomathiso Ho notation ena, li-operand li ngotsoe kamora mosebelisi. E boetse e tsejoa e le Sepheo sa Poland. Mohlala: + AB ke sehlongwapele. Infix Notation Ketsahalong ena, lisebelisoa li ngotsoe lipakeng tsa li-opereishene. Hoa tšoana le ...

Bala haholoanyane

Potso ea 542. Sheba li-Parentheses tse leka-lekaneng ka polelo Ho fuoe khoele ea bolelele n. Hlahloba hore na ho na le masakana a koalang masakaneng a mang le a mang a qalang, ke hore, haeba masakana ohle a lekana. Ka mantsoe a mang, re ka boela ra re, haeba re na le '}', ')' le ']' bakeng sa '{', '(' le '[' ka ho latellana, polelo ...

Bala haholoanyane

Potso ea 543. Teko ea Phatlalatso ea Postfix Tekolong ea bothata ba polelo ea postfix, re fane ka khoele s e nang le polelo ea postfix. Lekola polelo e fanoeng. Keletso ea Mohlala: s = "231 * + 9-" Khumo: -4 Keletso: s = "100 200 + 2/5 * 7 +" Sephetho: 757 Bakeng sa Operands Tse nang le Lits'oants'o tse le 'Ngoe tsa ...

Bala haholoanyane

Potso ea 544. Fumana hore na Tlhaloso e na le Pasehesis e Kopilitsoeng kapa Che E filoe khoele e nang le masakana a leka-lekaneng. Fumana hore na polelo / khoele e na le masakana a kopilitsoeng kapa che. Duplicate Parenthesis Ha polelo e le bohareng kapa e lika-likelitsoe ke mofuta o tšoanang oa masakana a leka-lekaneng, ke hore e kentsoe lipakeng tsa mofuta o tšoanang oa ho bula le ho koala masakana ho feta hang.

Bala haholoanyane

Potso ea 545. U ka kenya tšebetsong joang ho sebelisa lethathamo la lintho tse tlang pele kapa qubu? Kenya ts'ebetsong pokello ka thuso ea lethathamo la lintho tse tlang pele kapa qubu. Lethathamo la lintlha tse tlang pele bophelong le ts'oana le mohala kapa sebopeho sa data se bokellaneng ka tlatsetso ea mantlha. Ntho e ngoe le e ngoe e fuoa nomoro ea mantlha. Ha re phethela, likarolo tsa bohlokoa haholo li khethiloe ...

Bala haholoanyane

Potso ea 546. Mokhoa oa ho kenya ts'ebetsong hantle mekotla e le ngoe feela? Rala le ho kenya tšebetsong sebopeho se secha sa data se kenang ts'ebetsong ka mekhahlelo e le 'ngoe. Sebopeho sa data se secha se tlameha ho ts'ehetsa ts'ebetso tsena tse peli - Push (element, stack_number): e sutumelletsang element ka palo e fuoeng ea spaka. pop (stack_number): e hlahisang ntho e holimo ho e fanoeng ...

Bala haholoanyane

Potso ea 547. Fumana Boholo bo tebileng ba li-Parenthesis tse Nested ka khoele Fuoa khoele s. Ngola khoutu ho hatisa botebo bo boholo ba li-parenthesis ka sehokelong se fanoeng. Keletso ea Mohlala: s = “(a (b) (c) (d (e (f) g) h) I (j (k) l) m)” Tlhahiso: 4 Input: s = “(p ((q) Tlhahiso: 3 U sebelisa Algorithm ea Stack Qala khoele ea bolelele ...

Bala haholoanyane

Potso ea 548. Tlhatlhobo ea Tlhaloso Bothateng ba tlhahlobo ea polelo, re fane ka li-string s tsa bolelele n tse emelang polelo e ka bang le li-integer, masakana a leka-lekaneng, le ts'ebetso ea binary (+, -, *, /). Lekola polelo. Polelo e ka ba ho eng kapa eng ea sehlongwapele, infix, kapa notfatso ea poso. Mohlala Bona ...

Bala haholoanyane

Potso ea 549. U ka theha Stack e Ntle joang? Re tlameha ho rala le ho theha pokello e etsang ts'ebetso ka nako e sa fetoheng. Mona re na le bothata bo le bong ke hore na re ka etsa joang pokello e kopaneng? Mona re etsa ts'ebetso e ka tlase bakeng sa ho kopanya mekotla e 'meli. Push (element): Kenya element ka har'a mokotla. pop (): Tlosa ntho e holimo ho ...

Bala haholoanyane

Potso ea 550. Bothata ba The Stock Span Bothata bona "Bothata ba The Stock Span" bo tla tlasa karolo ea lichelete. Bothateng bona, re fumana setoko sa nako ea setoko sa letsatsi ka leng. Palo e phahameng ea matsatsi a latellanang pele ho letsatsi lefe kapa lefe leo theko ea setoko sa matsatsi a pele ho lona e leng ...

Bala haholoanyane

Potso ea 551. Fumana palo e kahodimodimo ea palo e ka lekanang ea mekotla e meraro Ho fanoe ka li-arrays tse 3 tsa stack1 [], stack2 [] le stack3 [] tse emelang mekotla le lenane la ho qala la lihlopha tsena li nkuoa e le tsona tse holimo. Fumana palo e kaholimo ho tsohle e ka khonehang meqolong eohle e meraro, ke hore, kakaretso ea likarolo tsa stack1, stack2 le stack3 lia lekana. Ho tlosoa ha ...

Bala haholoanyane

Potso ea 552. Hatisa lipotso tse latelang tse kholo tsa Q Bothateng ba lipotso tse hatisitsoeng tse latelang tse hatisitsoeng re hatisitse boholo ba [] boholo ba linomoro tse nang le linomoro le mofuta o mong oa q [] oa boholo ba limithara tse emelang lipotso. Potso ka 'ngoe e emela index ka tatellano []. Bakeng sa potso e ngoe le e ngoe, ke hatisa nomoro ho tsoa lenaneng ...

Bala haholoanyane

Potso ea 553. Lekola hore na Lethathamo le ka hlophisoa hantle Ha re hlahloba hore na bothata bo na le mathata a mangata hakae, re fane ka boholo ba [] ea boholo ba n e nang le likarolo ho tloha 1 ho isa ho n ka tatellano. Hlophisa lethathamo la ho nyoloha ka tatellano o sebelisa pokello ea nakoana kamora ts'ebetso ena e 'meli feela - Tlosa karolo qalong ...

Bala haholoanyane

Potso ea 554. Polelo e leka-lekaneng ka Phetolo Ka Phatlalatso e Leka-lekanang le bothata ba Phetolo re fane ka likhoele tse nang le masakaneng ke hore '(', ')', '[', ']', '{', '}'. Khoele e boetse e na le x libakeng tse ling e le sebaka sa li-parenthesis. Lekola hore na khoele e ka fetoloa poleloana e nang le masakana a nepahetseng kamora ho tlosa tsohle ...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 557. Ho tsosolosoa Recursion ke eng? Recursion e hlalosoa feela e le mosebetsi o ipitsang. E sebelisa mathata a eona a neng a rarollotsoe pejana ho bala bothata bo boholo. Ke e 'ngoe ea mehopolo ea bohlokoahali le e qhekellang lenaneong empa re ka e utloisisa habonolo ha re leka ho pheta ho ipheta le' nete ...

Bala haholoanyane

Potso ea 558. Selelekela ho Phetoho ea Infix Sehlomathisong sa bothata ba ho fetoha ha infix, re fane ka polelo ka mongolo wa ketapele. Ngola lenaneo ho e fetola infix expression. Sengoloa sa Prefix In notation ena li-operand li ngoloa kamora mosebelisi. E boetse e tsejoa e le Sepheo sa Poland. Mohlala: + AB ke sehlongwapele. ...

Bala haholoanyane

Potso ea 559. Postfix ho Phetoho ea Infix Ka bothata ba ho sokoloha ha postfix, re fane ka polelo ka mongolo oa postfix. Ngola lenaneo ho fetola notation e fanoeng ka infix notation. Infix Notation Ketsahalong ena, lisebelisoa li ngotsoe lipakeng tsa li-opereishene. E ts'oana le tsela eo ka kakaretso re ngolang polelo. Mohlala: A + ...

Bala haholoanyane

Potso ea 560. Setsi sa pele ho Phetoho ea Postfix Sehlomathisong sa bothata ba phetoho ea postfix, re fane ka polelo ka mongolo oa pele ho sebopeho sa mohala. Ngola lenaneo ho fetolela notation e fanoeng ka mongolo oa postfix. Sengoloa sa Prefix Ho notation ena, re ngola li-opereishene kamora mosebelisi. E boetse e tsejoa e le Sepheo sa Poland. Mohlala: + AB ke ...

Bala haholoanyane

Potso ea 561. Postfix ho Prefix Conversion Bothateng bona, re fane ka khoele e bolelang polelo ea postfix. Re tlameha ho etsa postfix ho fetolela sehlongwapele. Sengoloa sa Prefix Ho notation ena, re ngola li-opereishene kamora mosebelisi. E boetse e tsejoa e le Sepheo sa Poland. Mohlala: + AB ke sehlongwapele. Tsebiso ea Postfix Ho ...

Bala haholoanyane

Potso ea 562. 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 563. Backspace String Bapisa Ka khoele ea backspace bapisa bothata boo re bo fileng likhoele tse peli S le T, hlahloba hore na lia lekana kapa che. Hlokomela hore likhoele li na le '#' e bolelang sebopeho sa backspace. Mehlala Input S = “ab # c” T = “ad # c” Phello ea 'nete (joalo ka ha S le T li fetohela ho "ac") Ho kenya ...

Bala haholoanyane

Potso ea 564. Element e latelang e kholo Karolo e latelang e kholo ke bothata boo re faneng ka bona ka tatellano. Sehlopha sena se nang le boleng ba N (se kanna sa ba se setle kapa se fosahetseng). Re hloka ho fumana ea pele e kholo_element ka tatellano e fanoeng ka lehlakoreng la eona le letona. Haeba ho se na e kholo_emente nka -1. Fomate ea Input Mohala oa pele o nang le ...

Bala haholoanyane

Potso ea 565. Infix ho Postfix Infix polelo ke eng? Tlhaloso ka mokhoa oa "operand" opareitara "operand" e bitsoa infix expression. Mohlala: a + b Polelo ea postfix ke eng? Tlhaloso ka mokhoa oa 'operand' 'operand' 'opareitara' e bitsoa polelo ea postfix. Mohlala: ab + Ke eng tlhoko ea infix ho postfix phetoho? Infix expression e bonolo ...

Bala haholoanyane

Potso ea 566. Foromo e nyane ea Foromo ho latela tatellano e fanoeng ea li-D le tsa ka Polelo ea Bothata Bothateng ba "Fomoro e Nyane ea Foromo ho tloha tatelanong ea tatellano ea D's le Nna", re fane ka paterone e nang le li-D le li-D feela. Ke bakeng sa ho eketseha le D bakeng sa ho fokotseha. Ngola lenaneo ho hatisa palo e tlase ho latela paterone eo. Lidijiti ho tloha ho 1-9 le lipalo ha li khone ho pheta. Mofuta oa Keketso ...

Bala haholoanyane

Potso ea 567. Bothata ba Botumo Polelo ea Bothata Bothateng ba batho ba tummeng ho na le kamore ea batho ba N, Fumana motho ea tummeng. Maemo a Motho ea Tummeng ke- Haeba A ke Motho ea Tummeng joale mang le mang ka phapusing o lokela ho tseba A. A ha ea lokela ho tseba mang kapa mang ka phapusing. Re hloka ho fumana motho ea khotsofatsang maemo ana. ...

Bala haholoanyane

Potso ea 568. Element e kholo e latelang ka tatellano Polelo ea Bothata Ha re fuoa lethathamo, re tla fumana karolo e latelang e kholo ea ntlha ka 'ngoe ka tatellano. Haeba ho se na ntlha e latelang e kholo ea ntho eo re tla hatisa -1, ho seng joalo re tla e hatisa. Tlhokomeliso: Ntho e latelang e kholo ke ntho e kholo le ...

Bala haholoanyane

Amazon Queue Lipotso

Potso ea 569. Karolelano ea ho falla ho tsoa ho Tharollo ea Leetcode ea Data Stream Phatlalatso ea Bothata Karolelano e Tsoang ho tloha Data Stream LeetCode Tharollo - "Moving Average from Data Stream" e bolela hore ho fanoe ka palo ea li-integers le boholo ba fensetere k. Re hloka ho bala karolelano e tsamaeang ea linomoro tsohle tse fensetereng e thellang. Haeba palo ea likarolo ho ...

Bala haholoanyane

Potso ea 570. Fumana palo e phahameng ea boemo ba Binary Tree Polelo ea Bothata Bothata "Fumana palo e kahodimodimo ea Boemo ho Binary Tree" e re o fuoe sefate sa binary se nang le li-node tse ntle le tse mpe, fumana palo e phahameng ea sekhahla sefateng sa binary. Tlatsetso ea Mohlala 7 Tlhaloso ea Pele: Kakaretso = 5 Lekala la Bobeli: Sum = ...

Bala haholoanyane

Potso ea 571. 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 572. 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 573. Tsamaiso ea maemo e tsamaea ka mela e 'meli Polelo ea Bothata Bothata "Ho otlolla maemo ho sebelisa mela e 'meli" ho re o fuoe sefate sa binary, hatisa tatellano ea sona ea tatellano ka tatellano. Mehlala Keketso 5 11 42 7 9 8 12 23 52 3 Keletso 1 2 3 4 5 6 Algorithm ea Level Order Traversal ...

Bala haholoanyane

Potso ea 574. Kenya tšebetsong setoko u sebelisa lethathamo le le leng Polelo ea Bothata Bothata "Kenya ts'ebetsong setoko ka ho sebelisa lethathamo le le leng" e re kopa ho kenya tšebetsong sebopeho sa data sa stack (LIFO) re sebelisa mokoloko oa data (FIFO). Mona LIFO e bolela Last In First Out ha FIFO e bolela First In First Out. Mohlala sutumetsa (10) sutumetsa (20) holimo () pop () sutumelletsa (30) pop () holimo () Holimo: 20 ...

Bala haholoanyane

Potso ea 575. Fumana Leeto la Pele la Selikalikoe le etelang Lipompo tsohle tsa Petroli Polelo ea Bothata Bothata "Fumana Leeto la Pele la Selikalikoe le etelang Lipompo tsohle tsa Petroli" e re ho na le lipompo tsa N tsa peterole tseleng e chitja. Ho fanoe ka peterole eo pompo e 'ngoe le e' ngoe ea peterole e nang le eona le palo ea peterole e hlokahalang ho koahela sebaka se pakeng tsa lipompo tse peli tsa peterole. Kahoo o ...

Bala haholoanyane

Potso ea 576. Lekola hore na X e ka fana ka phetoho ho motho e mong le e mong Lethathamong Polelo Bothata X ke morekisi oa ice cream mme ho na le batho ba emeng moleng oa ho reka ice cream. Arr [i] e supa bolumeli ba motho ea lethathamong leno, boleng bo ka bang teng ba likereke ke 5, 10 le 20. Haeba chelete ea pele ea X e le 0 ...

Bala haholoanyane

Potso ea 577. 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 578. Linomoro tse nyane tsa likarolo tsa sebopeho li baloa ka khoele e fanoeng kamora ho tlosa litlhaku tsa k Polelo ea Bothata Bothata "Linomoro tse nyane tsa likarolo tsa semelo li baloa ka khoele e fanoeng kamora ho tlosa litlhaku tsa k" e re o fuoe khoele e nang le litlhaku tse tlase feela. U lumelloa ho tlosa litlhaku tsa k mohala ka hore mohaleng o setseng kakaretso ea ...

Bala haholoanyane

Potso ea 579. Nete ​​ea pele e fosahetseng lifensetereng tsohle tsa boholo k Polelo ea Bothata Bothata "Nete ea pele e fosahetseng fensetereng e 'ngoe le e' ngoe ea boholo k" e re u fuoe lethathamo le nang le linomoro tse nepahetseng le tse fosahetseng, bakeng sa fensetere e 'ngoe le e' ngoe ea boholo k hatisa palo ea pele e fosahetseng fensetereng eo. Haeba ho se na linomoro tse fosahetseng fensetereng efe kapa efe, joale tlhahiso e tla hlaha.

Bala haholoanyane

Potso ea 580. Mokoloko o thehiloe moleng oa motho oa pele ea sa pheta-phetoeng molatsoaneng Polelo ea Bothata Bothata "Mokhahlelo o ipapisitseng le lethathamo la motho oa pele ea sa pheteng molatsoaneng" o re o fuoe molapo o nang le litlhaku tse tlase, fumana motho oa pele ea sa pheteng neng kapa neng ha ho eketsoa tlhaku e ncha molatsoaneng, mme haeba ho le joalo ha ho khutliso ea semelo se sa pheta -1. Mehlala aabcddbe ...

Bala haholoanyane

Potso ea 581. Sebaka sa sele e haufinyane e nang le 1 ka popalo ea binary Polelo ea Bothata Bothata "Sebaka sa sele se haufi se nang le 1 ka popalo ea binary" se re o fuoa matrix ea binary (e nang le 0s le 1s feela) bonyane 1 e le ngoe. Fumana sebaka sa sele e haufinyane e nang le 1 matrix ea binary bakeng sa likarolo tsohle tsa ...

Bala haholoanyane

Potso ea 582. Mokhoa o Thahasellisang oa ho hlahisa linomoro tsa Binary ho tloha 1 ho isa ho n Polelo ea Bothata Bothata "Mokhoa o Thahasellisang oa ho hlahisa linomoro tsa Binary ho tloha 1 ho isa ho n" o re o filoe nomoro n, hatisa linomoro tsohle ho tloha 1 ho isa ho n ka sebopeho sa binary. Mehlala 3 1 10 11 6 1 10 11 100 101 110 Algorithm Moloko ...

Bala haholoanyane

Potso ea 583. Fumana palo e kholo ka ho fetisisa ea 3 Polelo ea Bothata Bothata "Fumana palo e kholo ka ho fetisisa ho tse tharo" e re o filoe lethathamo la linomoro tse nepahetseng (3 ho isa ho 0). Fumana palo e kaholimo ho tse 9 e ka thehoang ka ho hlophisa bocha likarolo tsa sehlopha. Mehlala arr [] = {3, 5, 2, 1, 0, 9} 3 9 ...

Bala haholoanyane

Potso ea 584. Lekola hore na sehlopha se fanoeng se ka emela Phallo ea Level Order ea Binary Search Tree Polelo ea Bothata Bothata "Hlahloba hore na sehlopha se fanoeng se ka emela Level Order Traversal of Binary Search Tree" se bolela hore o fuoe tatellano ea maemo ho parola sefate sa lipatlisiso. Le ho sebelisa tatellano ea maemo a sefate. Re hloka ho fumana hantle hore na tatellano ea boemo ...

Bala haholoanyane

Potso ea 585. Palo ea banab'eso ba Node e fanoeng ho n-ary Tree Polelo ea Bothata Bothata "Palo ea banab'eno ba Node e fanoeng ho n-ary Tree" e re o fuoa sefate sa n-ary le node ea sepheo. Fumana palo ea banab'eno ba node e lebisitsoeng. Nka hore node e lula e le teng sefateng 'me ntlha ea pele ke ...

Bala haholoanyane

Potso ea 586. Hlahloba hore na lethathamo le ka hlophisoa moleng o mong ho sebelisoa stack Polelo ea Bothata Bothata "Hlahloba hore na mola o ka hlophisoa moleng o mong o sebelisa pokello" o re o fuoe lethathamo le nang le li-elemente, likarolo tse molaong ke tumello ea linomoro 1 ho isa ho n. Lekola hore na lethathamo lena le ka hlophisoa ka tatellano e ntseng e eketseha ...

Bala haholoanyane

Potso ea 587. Mola o ka pele o sebelisa lenane le hokahaneng habeli Polelo ea Bothata Bothata "Lethathamo la lintho tse tlang pele pele le sebelisang lethathamo le kopantsoeng habeli" le kopa ho kenya tšebetsong mesebetsi e latelang ea lethathamo la tse tlang pele ka ho sebelisa lenane le hokahaneng habeli Push (x, p): Ngola ntlha ea x ka ntho e tlang pele holima lethathamo la maemo a pele sebakeng se loketseng. pop (): Tlosa 'me u khutlise ntho eo ka ho fetisisa pele ...

Bala haholoanyane

Potso ea 588. Litumello tsa Stack (Lekola hore na lethathamo ke tumello ea tse ling) Polelo ea Bothata Bothata "Litumello tsa Stack (Hlahloba hore na lethathamo ke tumello ea tse ling)" e re o fuoe lihlopha tse peli a [] le b [] ea boholo n. Lintlha tsohle tsa sehlopha li ikhethile. Etsa mosebetsi ho netefatsa hore na sehlopha se fanoeng b [] ke ...

Bala haholoanyane

Potso ea 589. Mehato e Monyane ea ho fihlela sepheo ke Knight Tlhaloso Bothata "Mehato e Monyane ea ho fihlela sepheo ke Knight" e re o filoe boto ea lisekoere ea chess ea litekanyo tsa N x N, likhokahano tsa sengoathoana sa Knight, le sele e shebiloeng. Fumana palo e tlase ea mehato e nkuoeng ke sengoathoana sa Knight ho fihlela sepheo ...

Bala haholoanyane

Potso ea 590. Ts'ebetsong ea Deque e sebelisa selikalikoe se chitja Polelo ea Bothata "Ts'ebetsong ea Deque o sebelisa selikalikoe" e kopa ho kenya tšebetsong mesebetsi e latelang ea Deque (Duely Ended Queue) u sebelisa selikalikoe, insertFront (x): kenya element x ka pele ho Deque insertRear (x): kenya element x ka morao ho Deque DeleFront (): hlakola ntho e tsoang ho ...

Bala haholoanyane

Potso ea 591. Fumana node ka boleng bo tlase ho Binary Search Tree Ha u fuoa Sefate sa Patlo ea Binary, ngola algorithm ho fumana node ka boleng bo tlase sefateng sa patlo ea binary. Mokgwa wa ho kenya Input Output 5 Naive Approach At mokhoa e bonolo ke ho etsa ho parola sefate ebe o fumana node e nang le boleng bo tlase hara li-node tsohle. Sena ...

Bala haholoanyane

Potso ea 592. Bonyane ba Bracket bo fetoha Bothateng bo tlase ba phetoho ea bracket, re file likhoele tse nang le polelo ea '{' le '}' feela. Fumana palo e nyane ea ho fetoha ha bracket e hlokahalang ho etsa hore polelo e leka-lekane. Mohlala Input: s = “} {” Output: 2 Input: s = “{{{” Output: The expression expression is not ...

Bala haholoanyane

Potso ea 593. Theha Sefate sa Binary se Felletseng ho tsoa ho Boemeli ba Lenane la Ts'ebeliso Ho fanoe ka lenane le hokahaneng le emelang sefate se felletseng sa binary. Lethathamo le hokahaneng le ka tatellano ea tatellano ea maemo ho haola sefate. Ngola algorithm ho aha sefate se felletseng sa binary ho tloha ho lenane la sona le hokahaneng. Ho kenya mohlala 1 -> 2 -> 3 -> 4 -> 5 ...

Bala haholoanyane

Potso ea 594. 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 595. U ka kenya tšebetsong joang ho sebelisa lethathamo la lintho tse tlang pele kapa qubu? Kenya ts'ebetsong pokello ka thuso ea lethathamo la lintho tse tlang pele kapa qubu. Lethathamo la lintlha tse tlang pele bophelong le ts'oana le mohala kapa sebopeho sa data se bokellaneng ka tlatsetso ea mantlha. Ntho e ngoe le e ngoe e fuoa nomoro ea mantlha. Ha re phethela, likarolo tsa bohlokoa haholo li khethiloe ...

Bala haholoanyane

Potso ea 596. Mola o ka pele ho C ++ Mokhoa oa FIFO o sebelisetsoa ho kenya lethathamo. Ka lethathamong, ho kentsoe ka lehlakoreng le leng (ka morao) mme ho tlosoa ho etsahala pheletsong e 'ngoe (ka pele). Ha e le hantle, elemente e kenang pele e hlakoloa pele. Re kenya tšebetso ea lethathamo la mantlha re sebelisa mesebetsi e hahelletsoeng ea c ++. Litšobotsi tsa lethathamo la mantlha lethathamo la mantlha ...

Bala haholoanyane

Potso ea 597. Lethathamo la Pele Lethathamo la mantlha ke mofuta oa sebopeho sa data se ts'oanang le lethathamo le tloaelehileng empa se na le taba ea mantlha e amanang le karolo ka 'ngoe ea sona. Phahamisa tse tlang pele pejana elemente e tla sebeletsoa. Maemong a mang, ho na le likarolo tse peli tse nang le sepheo se ts'oanang ka nako eo, elemente e ile ea ts'oaroa ...

Bala haholoanyane

Potso ea 598. 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 599. Mokhahlelo oa ho aha bocha ka bophahamo Bothata ba Tlhaloso ea Tlhatlhobo ea Molaetsa ka Bophahamo Ha re re u na le lenane le sa reroang la batho ba emeng moleng. Motho e mong le e mong o hlalosoa ke linomoro tse peli (h, k), moo h e leng bolelele ba motho mme k ke palo ea batho ba ka pela motho enoa ...

Bala haholoanyane

Potso ea 600. Tsela ea ho Tsamaea ha Binary Tree Level Order Traversal ea sefate se fanoeng sa binary e ts'oana le BFS ea sefate sa binary. Na re se re ntse re tseba hore na haele hantle BFS ke eng? Haeba ho se joalo ha ho hlokahale hore u utloe bohloko bala feela sengoloa sohle 'me u etele lingoliloeng tsa rona tse fetileng bakeng sa kutloisiso e betere. BFS ke ...

Bala haholoanyane

Potso ea 601. Breadth First Search (BFS) ea Kerafo Breadth First Search (BFS) ea graph ke algorithm e haolang kapa e batlisisang sebopeho sa data ea sefate / graph. E qala ho vertex e fuoeng (vertex efe kapa efe e hatellang) mme e hlahloba vertex eohle e hokahaneng mme kamora moo e fetela ho vertex e haufi mme e lekola li-node tsohle tse sa hlahlojoang mme e hlokomela hore ha ho ...

Bala haholoanyane

Lipotso tsa Amazon Matrix

Potso ea 602. Litsela Tse Ikhethang II Tharollo ea Leetcode Tlhaloso ea Bothata Litsela Tse Ikhethang II Tharollo ea LeetCode - "Litsela tse Ikhethang II" li bolela hore ho fanoe ka marang-rang a mxn moo roboto e qalang ho tloha ka holimo ho le letšehali la marang-rang. Re hloka ho fumana palo eohle ea litsela tsa ho fihla sekhutlong se ka tlase se letona sa marang-rang. ...

Bala haholoanyane

Potso ea 603. Batla Tharollo ea 2D Matrix II Leetcode Polelo ea Bothata Batla Tharollo ea 2D Matrix II LeetCode - "Batla 2D Matrix II" e u kopa ho fumana algorithm e sebetsang hantle e batlang sepheo sa boleng ho mxn integer matrix matrix. Linomoro moleng o mong le o mong, hammoho le kholomo, li hlophisoa ka tatellano e nyolohang. Mohlala: Kenyo: matrix = [[1,4,7,11,15],[2,5,8,12,19],[3,6,9,16,22],[10,13,14,17,24, 18,21,23,26,30],[5]], target = XNUMX Sephetho: nnete ...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 606. Litsela tse ikhethang II Ha re re monna ea emeng ka seleng ea pele kapa k'honeng e kaholimo ho le letšehali ea "matrix". Monna a ka sutha feela hodimo kapa tlase. Motho eo o batla ho fihla moo a eang mme sebaka seo a eang ho sona ke sele ea ho qetela ea matrix kapa sekhutlo se ka tlase le letona. ...

Bala haholoanyane

Potso ea 607. Fumana bolelele ba tatellano ea noha Bothata "Fumana bolelele bo phahameng ba tatellano ea linoha" e re re filoe gridi e nang le linomoro. Mosebetsi ke ho fumana tatellano ea linoha ka bolelele bo boholo. Ho latellana ho nang le linomoro tse haufi le gridi ka phapang e felletseng ea 1, ho tsejoa e le tatellano ea Noha. Haufi ...

Bala haholoanyane

Potso ea 608. Bothata ba Merafo ea Khauta Polelo ea Bothata "Bothata ba Morafo oa Khauta" e re o fuoa gridi ea 2D e nang le lichelete tsa tšepe tse seng mpe tse behiloeng ka seleng ka 'ngoe ea grid e fanoeng. Qalong, motho ea sebetsang morafong o eme kholomong ea pele empa ha ho na thibelo moleng. A ka qala moleng ofe kapa ofe. ...

Bala haholoanyane

Potso ea 609. 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 610. Sebaka sa sele e haufinyane e nang le 1 ka popalo ea binary Polelo ea Bothata Bothata "Sebaka sa sele se haufi se nang le 1 ka popalo ea binary" se re o fuoa matrix ea binary (e nang le 0s le 1s feela) bonyane 1 e le ngoe. Fumana sebaka sa sele e haufinyane e nang le 1 matrix ea binary bakeng sa likarolo tsohle tsa ...

Bala haholoanyane

Potso ea 611. Fumana lipara ka kakaretso e fuoeng hoo likarolo tsa lipara li leng mela e fapaneng Polelo ea Bothata "Fumana lipara tse nang le chelete e fuoeng hoo likarolo tsa lipara li leng mela e fapaneng" bothata bo re o filoe palo ea linomoro le boleng bo bitsoang "kakaretso". Polelo ea mathata e kopa ho fumana lipara tsohle ka har'a matrix tse akaretsang ho tse fuoeng ...

Bala haholoanyane

Potso ea 612. Lintho tse tloaelehileng meleng eohle ea matrix e fanoeng Polelo ea Bothata "Mathata a tloaelehileng melaong eohle ea matrix e fanoeng" bothata bo bolela hore, o fuoa matrix ea M * N. Polelo ea bothata e kopa ho fumana lintlha tsohle tse tloaelehileng ka har'a matrix moleng ka mong oa matrix ka nako ea O (M * N). Mohlala arr [] = {{12, 1, 4, 5, ...

Bala haholoanyane

Potso ea 613. Bokella lintlha tse phahameng ho gridi u sebelisa litselana tse peli Polelo ea Bothata Re fuoa matrix ea boholo "nxm", 'me re hloka ho bokella lintlha tse ngata marang-rang re sebelisa litselana tse peli. Haeba re eme seleng ea i, j joale re na le likhetho tse tharo tsa ho ea seleng ea 1, j kapa i + 1, j-1 kapa i + 1, j + 1. Ke hore ...

Bala haholoanyane

Potso ea 614. Bothata ba Letlapa la Keypad la mobile Polelo ea Bothata Mathateng a mobile keypad bothata, re nahana ka keypad ea linomoro. Re hloka ho fumana palo eohle ea tatellano ea linomoro tsa bolelele bo fanoeng hoo o lumelloang feela ho tobetsa likonopo tse holimo, tlase, ka ho le letšehali le ka ho le letona la konopo ea hajoale. Ha ua lumelloa ...

Bala haholoanyane

Potso ea 615. Mabokose a hatisang Bothateng ba ho Atisa Chain ea Matrix Polelo ea Bothata Re hloka ho fumana tatellano ea ho atisoa ha matriki hore palo ea ts'ebetso e amehang katisong ea matriki kaofela e fokotsehe. Ebe re hloka ho hatisa odara ena ke hore, ha re hatisa masakaneng bothateng ba katiso ea liketane tsa matrix. Nahana hore o na le litlelase tse 3 A, B, ...

Bala haholoanyane

Potso ea 616. Matrix e kholo ka ho fetisisa e likhutlo li 'ne eo kakaretso ea eona e leng 0 Polelo ea Bothata Fumana boholo bo boholo ba sub-matrix ka tatellano ea 2D eo palo ea eona e leng zero. Matrix ha se letho haese sehlopha sa 2D kahare ho sehlopha se fanoeng sa 2D. Kahoo, o na le matrix ea linomoro tse saennweng, o hloka ho bala kakaretso ea litlelase tse tlase mme o fumane matrix ka ...

Bala haholoanyane

Potso ea 617. Boholo ba khutlonne ea kakaretso ho matrix a 2D Polelo ea Bothata Fumana palo e kahodimodimo ya khutlonne ka matrix 2D ke hore ho fumana potlana e nang le palo e kahodimodimo. Matrix ha se letho haese sehlopha sa 2D kahare ho sehlopha se fanoeng sa 2D. Kahoo, o na le matrix ea linomoro tse saennweng, o hloka ho bala kakaretso ea litlelase tse tlase le ...

Bala haholoanyane

Potso ea 618. Katiso ya Chain ya Matrix Mathateng a mathathamo a II a katiso ea matrix, re fane ka litekanyo tsa matriki, fumana tatellano ea katiso ea bona joalo ka hore palo ea ts'ebetso e amehang katekisong ea matriki kaofela e fokotsehe. Nahana hore o na le litriki tsa 3 A, B, C tsa boholo ba axb, bx ...

Bala haholoanyane

Potso ea 619. 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 620. Beha Matrix a Matrix Mathateng a li-matrix zero set, re fane ka (n X m) matrix, haeba elemente e le 0, seta mola oa eona le kholomo ea 0. Mehlala Keketso: {[1, 1, 1] [1, 0, 1] [1, 1, 1]} Sephetho: {[1, 0, 1] [0, 0, 0] [1, 0, 1] ...

Bala haholoanyane

Potso ea 621. Moroallo Tlatsa LeetCode Bothateng ba ho Tlatsa Moroallo re fane ka sehlopha sa 2D [] [] se emelang setšoantšo sa size mxn ka boleng bo bong le bo bong bo emelang 'mala oa pixel ho khokahanyo eo. Hape ho fanoa ka sebaka sa pixel le 'mala. Kenya mmala sebakeng se itseng ...

Bala haholoanyane

Potso ea 622. Sebaka sa Max Island Tlhaloso ea Bothata: Ha ho fanoa ka matrix a 2D, matrix e na le 0 feela (e emelang metsi) le 1 (e emelang mobu) joalo ka litlatsetso. Sehlekehleke se matrix se theoa ka ho hlopha lihlopha tsohle tse haufinyane tsa 1 tse hokahantsoeng ka 4 (ka mokhoa o otlolohileng le o otlolohileng). Fumana sebaka se phahameng sa sehlekehleke ka har'a matrix. Nka hore likarolo tsohle tse 'ne tsa ...

Bala haholoanyane

Potso ea 623. Litsela Tse Ikhethileng Ho fanoa ka gridi ea mxn 2D 'me u eme kaholimo ho sele le ka ho le letšehali ho grid. ke hore sele e fumanehang ho (1,1). Fumana palo ea litsela tse ikhethileng tse ka nkuoang ho fihlela sele e fumanehang ho (m, n) ho tloha seleng e fumanehang ho (1,1) ...

Bala haholoanyane

Potso ea 624. K-th Element e nyane haholo ho Matrix e hlophisitsoeng Ho K-th Element e nyane haholo bothateng bo hlophisitsoeng ba Matrix, re fane ka matrix a nxn, moo mola o mong le o mong le kholomo e hlophisitsoeng ka tatellano e sa fokotseheng. Fumana karoloana e nyane ka ho fetisisa ea mofuta oa 2D. Ho kenya mohlala 1: k = 3 le matrix = 11, 21, 31, 41 ...

Bala haholoanyane

Potso ea 625. Katiso ea Chain ea Matrix u sebelisa Dynamic Programming Katleho ea Matrix ke mokhoa oo re fumanang mokhoa o motle oa ho atisa matrices ao re a filoeng. Kaofela rea ​​tseba hore katiso ea matrix e hokahane (A * B = B * A) ka tlhaho. Kahoo, re na le litaelo tse ngata tseo re batlang ho li atisa. Ebile, ka algorithm ena, ...

Bala haholoanyane

Potso ea 626. Katiso ea Materiki a mabeli Polelo ea Bothata Bothateng ba "Ho Atisoa ha Matrice a Mabeli" re file matric tse peli. Re tlameha ho atisa matrices ana le ho hatisa sephetho kapa matrix a hoqetela. Mona, boemo bo hlokahalang le bo lekaneng ke palo ea likholomo ho A e lokelang ho lekana le palo ea mela ea matrix ...

Bala haholoanyane

Potso ea 627. Hlahloba hore na Likhoele li K Distance Apart kapa Che Polelo ea Bothata Ha u fuoa likhoele tse peli le palo e kholo ea k, ngola lenaneo ho lekola hore na likhoele tse fanoeng li arohane kapa che. Ke hore haeba sebapali sefe kapa sefe se sa tšoane hantle kapa sebapali sefe kapa sefe se lokela ho tlosoa ka nako eo se tsejoa e le k hole hole. Sebopeho sa Input sa Pele ...

Bala haholoanyane

Potso ea 628. Fumana Row ka palo e kahodimodimo ea 1 Polelo ea Bothata Bothateng ba "Fumana Row ka Boholo ba Palo ea 1" re fane ka matrix (sehlopha sa 2D) se nang le linomoro tsa binary ka mola o mong le o mong o hlophisitsoeng. Fumana mola o nang le palo e phahameng ea li 1. Fomate ea ho Kena Mohala oa pele o nang le litekanyetso tse peli tsa linomoro n, m. E latelang, n mela ...

Bala haholoanyane

Potso ea 629. Bothata ba Botumo Polelo ea Bothata Bothateng ba batho ba tummeng ho na le kamore ea batho ba N, Fumana motho ea tummeng. Maemo a Motho ea Tummeng ke- Haeba A ke Motho ea Tummeng joale mang le mang ka phapusing o lokela ho tseba A. A ha ea lokela ho tseba mang kapa mang ka phapusing. Re hloka ho fumana motho ea khotsofatsang maemo ana. ...

Bala haholoanyane

Amazon Lipotso tse ling

Potso ea 630. Range Sum Query 2D - Tharollo e sa fetoheng ea Leetcode Tlhaloso ea Bothata Range Sum Query 2D - Immutable Leetcode Tharollo - Ho fanoe ka 2D matrix matrix, sebetsana le lipotso tse ngata tsa mofuta o latelang: Bala kakaretso ea likarolo tsa matrix ka har'a khutlontsi e hlalosoang ke sekhutlo sa eona se ka holimo le letšehali (row1, col1) le ka tlaase ho le letona. sekhutlo (row2, col2). Kenya tshebetsong sehlopha sa NumMatrix: NumMatrix(int[][] matrix) E qala ntho ka nomoro ...

Bala haholoanyane

Potso ea 631. 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 632. 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 633. Diagonal Traversal LeetCode Tharollo Polelo ea Bothata Tharollo ea Diagonal Traversal LeetCode - Ka lebaka la palo e felletseng ea 2D, khutlisetsa likarolo tsohle tsa lipalo ka tatellano ea diagonal joalo ka ha ho bonts'itsoe litšoantšong tse ka tlase. Kenyelletso: linomoro = [[1,2,3],[4,5,6],[7,8,9]] Sephetho: [1,4,2,7,5,3,8,6,9] Tlhaloso ea Diagonal Traversal LeetCode Solution Key Idea Mola oa pele le kholomo ea ho qetela bothateng bona e tla thusa ...

Bala haholoanyane

Potso ea 634. Ho Tsoa ha Haufi le Keno ka Maze LeetCode Solution Polelo ea Bothata Haufinyane o Tsoa ho Kena ka Maze LeetCode Tharollo – Re fuoa mxn matrix “maze” (0-indexed) e nang le lisele tse se nang letho tse emeloang joalo ka '.' le mabota joalo ka '+'. U boetse u fuoa monyako oa maze, moo monyako = [entrance_row, entrance_col] ho bolelang mola le kholomo ...

Bala haholoanyane

Potso ea 635. Tharollo e sebetsang ea Tic-Tac-Toe State LeetCode Polelo ea Bothata e sebetsa Tharollo ea LeetCode ea Tic-Tac-Toe State - Re fuoa boto ea Tic-Tac-Toe joalo ka boto ea likhoele 'me re kopuoa ho khutlisa' nete haeba ho khonahala ho fihlela boemo bona ba boto nakong ea tic- papali ea tac-toe. Letlapa le na le likarolo tse 3 x 3 ...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 637. Sefa Lijo tsa Lijo ka Li-Vegan-Friendly, Theko le Bohole Tharollo ea Leetcode Sefate sa Bothata Lijo tsa Sefa ka Vegan-Metsoalle, Theko, le Distance Leetcode Tharollo - Ho fanoe ka lireschorente tse ngata moo lireschorente[i] = [idi, ratingi, veganFriendlyi, pricei, distancei]. U tlameha ho sefa lireschorente u sebelisa li-filters tse tharo. Sesefa sa veganFriendly e tla ba 'nete (ho bolelang hore o tlameha ho kenyelletsa lireschorente tse nang le veganFriendlyi e behileng 'nete) kapa leshano (ho bolelang hore o ka kenyelletsa leha e le efe ...

Bala haholoanyane

Potso ea 638. Boemo bo Khanyang ka ho Fetisisa Seterateng LeetCode Tharollo Polelo ea Bothata Boemo bo Khanyang ka ho Fetisisa Seterateng LeetCode Tharollo - Re kopuoa ho nka mohala oa nomoro o emelang seterata. Seterata sena se na le mabone ho sona. Re fuoa "mabone" a palo e felletseng ea 2D. Lebone le leng le le leng[i] = [position_i, range_i] e bontša hore ho na le lebone la seterata holim'a position_i le ka khonang ...

Bala haholoanyane

Potso ea 639. 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 640. 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 641. Bonyane Height Trees LeetCode Tharollo Phatlalatso ea Bothata Bonyane Bophahamo ba Lifate tsa LeetCode Tharollo - Re fuoa sefate sa n nodes se ngotsoeng ho tloha ho 0 ho ea ho n-1 e le 2D array "medges" moo bohale[i] = [a_i, b_i] bo bontšang hore ho na le moeli o sa lebelloang pakeng tsa noto tse pedi a_i le b_i sefateng. Re na le ...

Bala haholoanyane

Potso ea 642. 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 643. Palo ea Lihlekehleke tsa II LeetCode Tharollo Polelo ea Bothata Palo ea Lihlekehleke tsa II LeetCode Tharollo - U fuoa 2D binary grid grid ea boholo ba mx n. Letlapa le emela 'mapa moo 0 e emelang metsi le 1 e emelang naha. Qalong, lisele tsohle ke lisele tsa metsi (ke hore, lisele tsohle ke tsa 0). Re ka etsa sebaka se eketsehileng ...

Bala haholoanyane

Potso ea 644. 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 645. Palo ea Dice Rolls With Target Sum LeetCode Solution Polelo ea Bothata Palo ea Dice Rolls With Target Sum LeetCode Solution - U na le dice 'me lefu ka leng le na le lifahleho tsa k tse baloang ho tloha ho 1 ho isa ho k. Ha ho fanoe ka linomoro tse tharo tsa n, k, le target, khutlisetsa palo ea litsela tse ka khonehang (ho tsoa ho kakaretso ea litsela) tsa ho theola letaese hore kakaretso ea linomoro tsa sefahleho e lekane le target. Hobane karabo e ka ba ...

Bala haholoanyane

Potso ea 646. 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 647. Tsela e Khutšoane ka ho Fetisisa Grid e nang le Litšitiso Pheliso ea LeetCode Tharollo Polelo ea Bothata Tsela e Khutšoane ka ho Fetisisa Grid e nang le Litšitiso Pheliso ea LeetCode Tharollo - U fuoa grid ea matrix ea mxn moo sele ka 'ngoe e leng 0 (letho) kapa 1 (tšitiso). O ka ea holimo, tlase, ho le letšehali, kapa ho le letona ho tloha le ho ea seleng e se nang letho ka mohato o le mong. Khutlisetsa palo e fokolang ea mehato eo u lokelang ho e tsamaea ho tloha ka holimo le letšehali ...

Bala haholoanyane

Potso ea 648. 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 649. 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 650. Sekaseka Webosaete ea Basebelisi Etela Mohlala LeetCode Tharollo Polelo ea Bothata Sekaseka Webosaete ea Mosebelisi Etela Mohlala oa LeetCode Tharollo - U fuoa mefuta e 'meli ea li-username le sebaka sa marang-rang le setempe sa linako tse felletseng. Litlhophiso tsohle tse fanoeng li bolelele bo lekanang 'me tuple [lebitso la mosebelisi[i], sebaka sa marang-rang[i], timestamp[i]] e bonts'a hore lebitso la mosebelisi[i] etetse sebaka sa marang-rang[i] ka timestamp[i]. Paterone ke lethathamo la liwebsaete tse tharo (eseng hore li fapane). Ka mohlala, ["lehae", ...

Bala haholoanyane

Potso ea 651. 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 652. Haufi le Binary Search Tree Boleng Leetcode Tharollo Polelo ea Bothata : Haufinyane Binary Search Tree Value Leetcode Tharollo - Ho fanoe ka motso oa sefate sa lipatlisiso sa binary le boleng ba sepheo, khutlisetsa boleng ho BST e haufi le sepheo. Mohlala : Mohlala 1 Kenyeletso: motso = [4,2,5,1,3], target = 3.714286 Output: 4 Mohlala 2 Keno: motso = [1], target ...

Bala haholoanyane

Potso ea 653. 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 654. Moralo oa Nalane ea Sebatli Tharollo ea LeetCode Tlhaloso ea Bothata Histori ea Sebatli Tharollo ea LeetCode - U na le sebatli se nang le tabo e le 'ngoe moo u qalang leqepheng la lehae' me u ka etela url e 'ngoe, khutlela ho palo ea histori ea mehato kapa u tsoele pele historing ea palo ea mehato. Kenya tshebetsong sehlopha sa BrowserHistory: BrowserHistory(leqephe la lapeng la khoele) E qala ntho ka leqephe la lehae la ...

Bala haholoanyane

Potso ea 655. 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 656. 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 657. Contiguous Array LeetCode Tharollo Phatlalatso ea Bothata Contiguous Array LeetCode Tharollo - Ho fanoe ka linomoro tsa binary array, khutlisetsa bolelele bo boholo ba sebaka sa marang-rang se nang le palo e lekanang ea 0 le 1. Input: nums = [0,1] Output: 2 Tlhaloso: [0, 1] ke sebaka se selelele ka ho fetesisa se nang le palo e lekanang ya 0 le 1. Tlhaloso Joale seo re se ...

Bala haholoanyane

Potso ea 658. Boholo ba Liketsahalo tsa Tharollo ea Leetcode ea Substring Polelo ea Bothata : Palo e kholo ea Liketsahalo tsa Tharollo ea Leetcode ea Substring - Ho fanoe ka khoele s, khutlisetsa palo e kholo ea liketsahalo tsa substring leha e le efe tlas'a melao e latelang: Palo ea litlhaku tse ikhethang ho substring e tlameha ho ba ka tlaase ho kapa ho lekana le maxLetters. Saese e tlase e tlameha ho ba lipakeng tsa minSize le maxSize kaofela. Mohlala ...

Bala haholoanyane

Potso ea 659. 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 660. 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 661. 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 662. 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 663. 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 664. Eketsa Bohole ho Motho ea Haufi ka ho Fetisisa Tharollo ea LeetCode Phatlalatso ea Bothata Eketsa Sebaka ho Motho ea Haufi ka ho Fetisisa Tharollo ea LeetCode - U fuoa sehlopha se emelang mokoloko oa litulo moo litulo[i] = 1 e emela motho ea lutseng setulong sa ith, 'me litulo[i] = 0 li emela hore setulo sa ith ha se na letho. (0-indexed). Ho na le bonyane setulo se le seng se se nang letho, 'me bonyane ho lutse motho a le mong. Alex o batla ho...

Bala haholoanyane

Potso ea 665. Tharollo ea Boraro ea Boholo ba Leetcode Phatlalatso ea Bothata Tharollo ea Tharollo ea Tharollo ea Leetcode - Ha u fuoa palo e felletseng ea palo, khutlisetsa palo e phahameng ea boraro e ikhethileng lethathamong lena. Haeba boholo ba boraro bo le sieo, khutlisetsa palo e holimo. Mohlala oa Kenyeletso: lipalo = [3,2,1] Sephetho: 1 Tlhaloso: Boholo bo ikhethang ba pele ke 3. Bongata bo ikhethileng ba bobeli ke 2. Ea boraro ...

Bala haholoanyane

Potso ea 666. Tharollo ea LeetCode ea Minesweeper Problem Statement Minesweeper LeetCode Solution – Ha re bapale papali ea merafo (Wikipedia, papali ea inthaneteng)! U fuoa boto ea matrix ea mxn char e emelang boto ea papali moo: 'M' e emelang morafo o sa senoloang, 'E' e emela sekoere se sa senoloang, 'B' e emela lisekoere tse senotsoeng tse se nang merafo e haufi (ke hore, ka holimo, ka tlase. , ho le letšehali, ho le letona, le tsohle ...

Bala haholoanyane

Potso ea 667. 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 668. Nako e Thehiloeng ke Key-Boleng Store LeetCode Tharollo Polelo ea Bothata Nako e Thehiloeng Lebenkeleng la Bohlokoa LeetCode Tharollo - Etsa moralo oa data oa bohlokoa oa nako o ka bolokang litekanyetso tse ngata bakeng sa senotlolo se le seng ka litempe tsa nako tse fapaneng le ho fumana boleng ba senotlolo ka setempe se itseng sa nako. Kenya ts'ebetsong sehlopha sa TimeMap: TimeMap() E qala morero oa sebopeho sa data. void set(Senotlolo sa khoele, Khoele ...

Bala haholoanyane

Potso ea 669. 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 670. 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 671. 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 672. Asteroid Collision LeetCode Tharollo Problem Statement Asteroid Collision LeetCode Solution - Re fuoa sehlopha sa linaleli sa linaleli tse emelang li-asteroid ka tatellano. Bakeng sa asteroid ka 'ngoe, boleng bo feletseng bo emela boholo ba eona, 'me letšoao le emela tataiso ea eona (moelelo o nepahetseng o nepahetseng, moelelo o fosahetseng o setseng). Asteroid ka 'ngoe e tsamaea ka lebelo le tšoanang. Fumana naha...

Bala haholoanyane

Potso ea 673. Hlophisa hape Lintlha ho Lifaele Tsa Log LeetCode Tharollo Phatlalatso ea Bothata Hlophisa Lintlha ka Lifaele Tsa Log LeetCode Tharollo - U fuoa mefuta e mengata ea lifate. Loko e 'ngoe le e 'ngoe ke letoto la mantsoe le arotsoeng sebaka, moo lentsoe la pele e leng sekhetho. Ho na le mefuta e 'meli ea lifate: Li-logs: Mantsoe ohle (ntle le ID) a na le litlhaku tse nyane tsa Senyesemane. Digit-logs: Mantsoe ohle ...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 676. Palo ea Lihlekehleke Tse Koetsoeng Tharollo ea Leetcode Polelo ea Bothata : Palo ea Lihlekehleke Tse Koetsoeng Tharollo ea Leetcode - Ho fanoe ka marang-rang a 2D a nang le 0s (naha) le 1s (metsi). Sehlekehleke ke sehlopha se hokahaneng ka 4-directionally ea li-0 mme sehlekehleke se koetsoeng ke sehlekehleke ka ho felletseng (kaofela ka ho le letšehali, holimo, ka ho le letona, ka tlase) se pota-potiloeng ke 1s. Khutlisetsa palo ea lihlekehleke tse koetsoeng. Mohlala : Mohlala 1 Kenyeletso: grid = [[1,1,1,1,1,1,1,0],[1,0,0,0,0,1,1,0],[1,0,1,0,1,1,1,0, 1,0,0,0,0,1,0,1],[1,1,1,1,1,1,1,0],[2]] Sephetho : XNUMX Tlhaloso: Lihlekehleke tse putsoa ...

Bala haholoanyane

Potso ea 677. 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 678. 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 679. 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 680. 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 681. 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 682. 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 683. 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 684. 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 685. Element e sieo ho Tharollo e Hlophisitsoeng ea LeetCode Polelo ea Bothata: Element e sieo ka har'a Array Array LeetCode Tharollo - Ho fanoe ka palo e felletseng ea palo e hlophisoang ka tatellano e nyolohang 'me likarolo tsohle tsa eona li ikhethile 'me li fanoe hape ka palo ea k, khutlisetsa kth nomoro e sieo ho tloha ho palo e ka ho le letšehali ea lenane. Mohlala: Mohlala 1 Kenyeletso: lipalo = [4,7,9,10], k = ...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 688. 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 689. 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 690. 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 691. 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 692. 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 693. Fumana Boleng bo Kholo ka ho Fetisisa Tharollong ka 'ngoe ea Sefate Row LeetCode Polelo ea Bothata Fumana Boleng bo Boholo ka ho Fetisisa Moleng o Mong le o Mong oa LeetCode Tharollo - Ho fanoe ka motso oa sefate sa binary, khutlisetsa sehlopha sa boleng bo boholo ka ho fetisisa moleng o mong le o mong oa sefate (0-indexed). Mohlala oa Tlhahlobo ea 1: Kenyelletso: motso = [1, 3, 4, 5, 3, null, 9] Sephetho: [1, 3, 9] Tlhaloso 1, 3, le ...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 697. Tharollo ea LeetCode e Laolehileng Problem Statement Orderly Queue LeetCode Solution - U fuoa khoele s le palo e feletseng k. U ka khetha e 'ngoe ea litlhaku tsa k tsa pele tsa s' me u e kopanye qetellong ea khoele. Khutlisetsa khoele e nyenyane ka ho fetisisa ea lexicographically eo u ka bang le eona ka mor'a ho sebelisa mohato o boletsoeng palo efe kapa efe ea metsamao. Kenyelletso: s...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 701. 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 702. 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 703. 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 704. Tharollo ea LeetCode ea Nako ea mahala ea Basebetsi Polelo ea Bothata Tharollo ea Nako ea Mahala ea Basebetsi LeetCode - Re fuoa lethathamo la lenane la basebetsi, le emelang nako ea ho sebetsa bakeng sa mosebeletsi e mong le e mong. Mosebeletsi e mong le e mong o na le lethathamo la Linako tse sa amaneng, 'me linako tsena li hlophisoa. Khutlisetsa lenane la linako tse lekanyelitsoeng tse emelang nako ea mahala e tloaelehileng, ea bolelele bo nepahetseng bakeng sa basebetsi bohle, le ...

Bala haholoanyane

Potso ea 705. Minimum Possible Integer After at Most K Haufi le Swaps On Digits LeetCode Solution Problem Statement Minimum Possible Integer After at Most K Adjacent Swaps On Digits LeetCode Solution – O fuwa thapo num e emelang dinomoro tsa palo e kgolo haholo le palo e feletseng k. U lumelloa ho fapanyetsana linomoro life kapa life tse peli tse bapileng ka makhetlo a k. Khutlisetsa bonyane palo e felletseng eo u ka e fumanang hape ...

Bala haholoanyane

Potso ea 706. 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 707. Fumana Bonyane ho Tharollo e Hlophisitsoeng ea Rotated Array II LeetCode Polelo ea Bothata Fumana Bonyane ho Rotated Sorted Array II LeetCode Tharollo - Ha re re lethathamo la bolelele ba n le hlophisoa ka tatellano e nyolohang le potoloha pakeng tsa 1 le linako tsa n. Ka mohlala, palo ea lipalo = [0,1,4,4,5,6,7] e ka 'na ea e-ba: [4,5,6,7,0,1,4] haeba e ne e fetotsoe ka makhetlo a 4. [0,1,4,4,5,6,7] haeba e ne e fetotsoe ka makhetlo a supileng. Hlokomela hore ho potoloha letoto [a[7], a[0], a[1], ..., a[n-2]] ha 1 ho fella ka mokoloko [a[n-1], a[1] , a[0], a[1], ...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 710. Fumana haeba Tsela e Teng ho Tharollo ea Graph Leetcode Polelo ea Bothata Fumana Haeba Tsela e Teng ho Graph Leetcode Tharollo - Ho na le graph ea bi-directional e nang le li-n vertices, moo vertex ka 'ngoe e ngotsoeng ho tloha 0 ho ea ho n - 1 (ho kenyeletsoa). Mathōko a kerafo a emetsoe e le mathōko a 2D a palo e felletseng, moo mahlakore ka 'ngoe[i] = [ui, vi] e supang moeli oa mahlakore a mabeli pakeng tsa vertex ui le vertex vi. Sehlopha se seng le se seng sa vertex ...

Bala haholoanyane

Potso ea 711. Lekhasi le Haufi ka ho Fetisisa ho Binary Tree LeetCode Tharollo Polelo ea Bothata Lekhasi le Haufi ka ho Fetisisa Tharollo ea LeetCode ea Sefate sa Binary - Ho fanoe ka motso oa sefate sa binary moo node e 'ngoe le e 'ngoe e nang le boleng bo ikhethang le palo e feletseng ea k, khutlisetsa boleng ba lekhasi le haufi le lekhasi ho sepheo sa k sefateng. Haufi le lekhasi ho bolela palo e fokolang ea mathōko a tsamauoang holim'a sefate sa binary ho ea ...

Bala haholoanyane

Potso ea 712. 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 713. Litšebelisano tse Fosahetseng Tharollo ea LeetCode Phatlalatso ea Bothata Litšebetso tse Fosahetseng Tharollo ea LeetCode - Ts'ebetso e ka 'na ea se ke ea sebetsa haeba: chelete e feta $ 1000, kapa; haeba e etsahala ka hare ho (le ho kenyeletsa) metsotso e 60 ea khoebo e 'ngoe e nang le lebitso le tšoanang motseng o mong. U fuoa lethathamo la likhoele tsa transaction moo transaction[i] e nang le boleng bo arohaneng ba likoma tse emelang lebitso, nako (ka metsotso), palo, le toropo ...

Bala haholoanyane

Potso ea 714. 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 715. 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 716. Khutlisa Liaterese Tsa IP Leetcode Tharollo Polelo ea Bothata Ho Khutlisa Liaterese Tsa IP Tharollo ea LeetCode - "Khutlisa Liaterese tsa IP" e bolela hore ho fanoe ka mohala o nang le linomoro feela, re hloka ho khutlisetsa liaterese tsohle tsa IP tse ka khonehang ka tatellano leha e le efe e ka etsoang ka ho kenya matheba khoeleng. Hlokomela hore ha rea ​​lumelloa ho khutla...

Bala haholoanyane

Potso ea 717. 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 718. Minimum Swaps Ho Etsa Tatelano Ho Eketsa Tharollo ea LeetCode Polelo ea Bothata Ho Fetolana Ho Nyenyane Ho Etsa Tatelano Ho Holisa Tharollo ea LeetCode - U fuoa lihlopha tse peli tse felletseng tsa bolelele bo lekanang nums1 le nums2. Ts'ebetsong e le 'ngoe, u lumelloa ho fapanyetsana nums1[i] le nums2[i]. Mohlala, haeba nums1 = [1,2,3,8], le nums2 = [5,6,7,4], u ka fapanyetsana element ho i = 3 ho fumana nums1 = [1,2,3,4 ] le linomoro2 = [5,6,7,8]. ...

Bala haholoanyane

Potso ea 719. Sheba ho phethahala ha Tharollo ea Binary Tree LeetCode Polelo ea Bothata Hlahloba ho Phethahala ha Binary Tree LeetCode Tharollo - Ho fanoe ka motso oa sefate sa binary, fumana hore na ke sefate sa binary se feletseng. Sefateng se feletseng sa binary, tekanyo e 'ngoe le e' ngoe, ntle le mohlomong ea ho qetela, e tletse ka ho feletseng, 'me li-node tsohle tse boemong ba ho qetela li le hole kamoo ho ka khonehang. ...

Bala haholoanyane

Potso ea 720. Kerafo e nepahetseng ea Sefate sa LeetCode Tharollo Polelo ea Bothata Kerafo e Tiileng ea Sefate sa LeetCode Tharollo - Ho fanoe ka mathōko a kerafo, hlahloba hore na mathōko a etsa sefate se nepahetseng. Haeba ho joalo, khutlisetsa 'nete le bohata ka tsela e 'ngoe. Mathoko a fanoe e le 2D array ea boholo n*2 Mehlala & Litlhaloso Mohlala 1: Kenyelletso: n = 5, ...

Bala haholoanyane

Potso ea 721. Spiral Matrix II Tharollo ea Leetcode Potso ea Bothata Potsong ena, re kopuoa ho hlahisa matrix ea boholo n* n e nang le likarolo ka tatellano ea spiral, mme ke n ...

Bala haholoanyane

Potso ea 722. Web Crawler LeetCode Tharollo Setatamente sa Bothata Web Crawler LeetCode Tharollo - Ha u fuoa URL startUrl le interface HtmlParser, kenya ts'ebetso ea web crawler ho khasa lihokelo tsohle tse tlas'a lebitso la moamoheli joalo ka startUrl. Khutlisetsa li-URL tsohle tse fumanoeng ke sebatli sa hau sa Marang-rang ka tatellano efe kapa efe. Sebapali sa hau se lokela ho: Qala leqepheng lena: qalaUrl Letsetsa HtmlParser.getUrls(url) ho fumana li-URL tsohle leqepheng la tepo la ...

Bala haholoanyane

Potso ea 723. E 'ngoe Edit Distance LeetCode Tharollo Phatlalatso ea Bothata E 'ngoe Edit Distance LeetCode Tharollo - Ho fanoe ka likhoele tse peli s le t, khutlela 'nete haeba ka bobeli e le sebaka se le seng sa ho hlophisa, ho seng joalo khutlela bohata. Khoele e boleloa e le sebaka se le seng ho arohana le khoele t haeba u ka khona: Kenya tlhaku e le 'ngoe hantle ho s ho fumana t. Hlakola tlhaku e le 'ngoe hantle ho tloha ho s ho fumana t. Fetolela tlhaku e le 'ngoe ea s ka sebopeho se fapaneng ho fumana t. Kenyelletso:...

Bala haholoanyane

Potso ea 724. Tharollo e ka khonehang ea Bipartition LeetCode Phatlalatso ea Bothata e ka khonehang Bipartition LeetCode Tharollo - Re batla ho arola sehlopha sa batho ba n (ba ngotsoeng ho tloha ho 1 ho ea ho n) ka lihlopha tse peli tsa boholo leha e le bofe. Motho ka mong a ka ’na a se ke a rata batho ba bang, ’me ha baa lokela ho kena sehlopheng se le seng. Ho fanoe ka nomoro ea n le lihlopha tse sa rateheng moo li sa rateheng[i] = [ai, bi] li bontša hore motho ea ngotsoeng ai o etsa ...

Bala haholoanyane

Potso ea 725. Tharollo ea LeetCode ea Bohlokoa ba Basebetsi Polelo ea Bothata Bohlokoa ba LeetCode Tharollo - O na le sebopeho sa data sa tlhahisoleseling ea mohiruoa, ho kenyeletsoa ID ea mohiruoa e ikhethang, boleng ba bohlokoa, le li-ID tsa basebetsi ba ka tlase. U fuoa sehlopha sa basebetsi ba basebetsi moo: basebetsi[i].id ke ID ea mohiruoa oa ith. basebetsi[i].bohlokoa ke boleng ba bohlokoa ba mosebetsi oa ith. basebetsi[i].batlas'a ke lethathamo la ...

Bala haholoanyane

Potso ea 726. 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 727. Kth Sehlahisoa se Senyenyane ka ho Fetisisa sa Mefuta e 'meli e Hlophisitsoeng ea LeetCode Tharollo Polelo ea Bothata Kth Sehlahisoa se Senyenyane ka ho Fetisisa sa Mefuta e 'Meli e Hlophisitsoeng ea LeetCode Tharollo - Ho fanoe ka lihlopha tse peli tse hlophisitsoeng tsa 0-indexed integer nums1 le nums2 hammoho le palo ea k, khutlisetsa kth (1-based) sehlahisoa se senyenyane sa nums1[i] * nums2[j] moo 0 <= ke < nums1.length le 0 <= j < nums2.length. Kenyelletso: nums1 = [2,5], nums2 = [3,4], k = 2 Sephetho: 8 Tlhaloso: The 2 ...

Bala haholoanyane

Potso ea 728. Kill Process LeetCode Tharollo Problem Statement Kill Process LeetCode Solution - U na le mekhoa ea ho theha sebopeho sa sefate se metse ka metso. U fuoa mefuta e 'meli e felletseng ea pid le ppid, moo pid[i] e leng ID ea ts'ebetso ea ith le ppid[i] ke ID ea ts'ebetso ea motsoali oa ith. Ts'ebetso e 'ngoe le e' ngoe e na le ts'ebetso ea motsoali a le mong empa e ka ba le mekhoa e mengata ea bana. Ke ts'ebetso e le 'ngoe feela e nang le ppid[i] = 0, ...

Bala haholoanyane

Potso ea 729. Tsela e nang le Tharollo ea Bonyane Bonyane ba LeetCode Tsela ea Phatlalatso ea Bothata Ka Tharollo e Phahameng ea Bonyane ba Boleng ba LeetCode - Ha u fuoa marang-rang a marang-rang a mxn, khutlisetsa lintlha tse ngata tsa tsela e qalang ho (0, 0) le ho fella ka (m - 1, n - 1) ho ea ka litsela tse 4 tsa cardinal. Lintlha tsa tsela ke boleng bo tlase tseleng eo. Ka mohlala, lintlha tsa ...

Bala haholoanyane

Potso ea 730. 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 731. 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 732. Moralo Hit Counter LeetCode Tharollo Moralo oa Setatemente sa Bothata Hit Counter LeetCode Tharollo - Rala k'haontareng ea ho otla e balang palo ea lipina tse fumanoeng metsotsong e 5 e fetileng (ke hore, metsotsoana e 300 e fetileng). Sistimi ea hau e lokela ho amohela paramethara ea setempe sa nako (ka metsotsoana ea granularity), 'me u ka nahana hore mehala e ntse e etsoa ho sistimi ka tatellano ea liketsahalo (ke hore, setempe sa nako se eketseha ka mokhoa o le mong). ...

Bala haholoanyane

Potso ea 733. 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 734. 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 735. 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 736. 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 737. 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 738. Tlhaloso ea Lentsoe LeetCode Tharollo Polelo ea Bothata Tharollo ea Lentsoe LeetCode Tharollo - Re fuoa likhoele tsa 2 - "s" le "mohlala", re hloka ho fumana hore na mohlala o latela s. Ho latela mona ho bolela papali e felletseng. Ka mokhoa o hlophisitsoeng, re ka khona molemong o mong le o mong[i] ho tlameha ho ba le s[i] e le 'ngoe feela, ka tsela e fapaneng ke hore ho na le ...

Bala haholoanyane

Potso ea 739. Boholo ba Sehlahisoa sa Linomoro tse tharo Tharollo ea LeetCode Phatlalatso ea Bothata Boholo ba Sehlahisoa sa Linomoro Tse Tharo Tharollo ea LeetCode - Re fuoa mefuta e mengata, potso e re botsa hore re bale sehlahisoa se seholo sa linomoro leha e le life tsa 3. Mehlala Mohlala 1: Kenyeletso: dipalo = [1,2,3] Sephetho: 6 Mohlala 2: Moputso: dipalo = [1,2,3,4] Sephetho: 24 Mohlala 3: Sephetho: palo = ...

Bala haholoanyane

Potso ea 740. 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 741. 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 742. Random Pick Index LeetCode Tharollo Problem Statement Random Pick Index LeetCode Solution- Re fuoa sehahi sa sehlopha sa "Tharollo" le "khetho" ea mofuta oa int. Re kopuoa ho kenya tšebetsong sehlopha sa "Tharollo" joalo ka Tharollo(int[] nums) E qala ntho ka lipalo tse ngata. int pick(int target) E khetha index ea tšohanyetso ho tsoa ho linomoro moo nums[i] == target. Haeba ho na le tse ngata ...

Bala haholoanyane

Potso ea 743. 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 744. Sehlahisoa sa Subarray se Tlas'a Tharollo ea K LeetCode Problem Statement Sehlahiswa sa Subarray se Tlase ho Feta K LeetCode Tharollo - Ka lebaka la palo e felletseng ya palo e felletseng le palo e felletseng ya k, khutlisetsa palo ea li-subarray tse kopaneng moo sehlahisoa sa likarolo tsohle tsa sehlopha se tlase ho k. Mohlala oa Taba ea 1: Kenyeletso: inputArr = [10, 5, 2, 6] k = 100 ...

Bala haholoanyane

Potso ea 745. Reverse Feela Letters Tharollo ea LeetCode Phatlalatso ea Bothata Reverse Feela Letters Tharollo ea LeetCode - Ho fanoe ka khoele s, fetola khoele ho latela melao e latelang: Litlhaku tsohle tseo e seng litlhaku tsa Senyesemane li lula li le boemong bo le bong. Litlhaku tsohle tsa Senyesemane (litlhaku tse nyane kapa tse kholo) li tlameha ho khutlisoa. Khutlisetsa s ka mor'a ho e khutlisetsa morao. Kenyelletso: s = "ab-cd" ...

Bala haholoanyane

Potso ea 746. Pheta-pheta Substring Pattern LeetCode Tharollo Polelo ea Bothata e Phethahetseng Substring Pattern LeetCode Tharollo - Ho fanoe ka khoele s, hlahloba hore na e ka hahoa ka ho nka karoloana ea eona le ho kopanya likopi tse ngata tsa khoele e nyenyane hammoho. Kenyelletso: s = "abab" Sephetho: 'nete Tlhaloso: Ke tlhalenyana "ab" habeli. Tlhaloso Char ea pele ea ...

Bala haholoanyane

Potso ea 747. Palo ea Matsatsi Pakeng tsa Matsatsi a mabeli Tharollo ea LeetCode Polelo ea Bothata Potso Palo ea Matsatsi Pakeng tsa Matsatsi a mabeli Tharollo ea LeetCode e re kopa ho bala palo e tobileng ea matsatsi pakeng tsa matsatsi a 2 a fanoeng ho kenyeletsa le leap years. Matsatsi a fanoe e le likhoele ka mokhoa oa YYYY-MM-DD. Hape ho fanoe ka hore matsatsi a ho kenya ke matsatsi a nepahetseng pakeng tsa ...

Bala haholoanyane

Potso ea 748. Khoele e Kentsoeng Ka Tharollo ea LeetCode ea Bolelele bo Bokhutšoane Polelo ea Bothata Khoele e Kentsoeng ka Bolelele bo Bokhuts'oane ka ho Fetisisa Tharollo ea LeetCode - Ho fanoe ka khoele s, khola khoele e le hore bolelele ba eona bo kentsoeng bo be bokhutšoane ka ho fetisisa. Molao oa khouto ke: k[encoded_string], moo khoele_encoded ka har'a masakaneng a lisekoere e phetoang hantle ka makhetlo a k. k e lokela ho ba palo e felletseng. Haeba ts'ebetso ea encoding e sa etse ...

Bala haholoanyane

Potso ea 749. 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 750. Binary Tree Nako e telele ka ho Fetisisa Tatelano LeetCode Tharollo Phatlalatso ea Bothata Sefate sa Binary Tree Nako e telele ka ho Fetisisa Tatelano ea LeetCode Tharollo - Ho fanoe ka motso oa sefate sa binary, khutlisetsa bolelele ba tsela e telele ka ho fetisisa e latellanang. Tsela e bua ka tatellano efe kapa efe ea li-node ho tloha node e qalang ho ea ho node leha e le efe sefateng hammoho le likhokahano tsa motsoali le ngoana. Nako e telele ka ho fetisisa e latellanang ...

Bala haholoanyane

Potso ea 751. Perfect Squares LeetCode Tharollo Polelo ea Bothata The Perfect Squares LeetCode Solution - "Perfect Squares" e bolela hore ho fanoe ka palo e feletseng n 'me u lokela ho khutlisa palo e fokolang ea lisekoere tse phethahetseng tseo kakaretso ea tsona e lekanang le n. Hlokomela hore sekwere se ts'oanang se phethahetseng se ka sebelisoa hangata. Mohlala: Kenyeletso: n = 12 Sephetho: 3 Tlhaloso: ...

Bala haholoanyane

Potso ea 752. Fetola Distance LeetCode Tharollo Setatamente sa Bothata Bothata Edita Distance LeetCode Solution e re o filoe likhoele tse peli word1 le word2 mme o hloka ho fetolela lentsoe1 ho lentsoe2 ts'ebetsong e fokolang. Lits'ebetso tse ka etsoang khoeleng ke - Kenya tlhaku Hlakola tlhaku Beha sebapali Sebaka Mehlala Nyeoe ea Teko ...

Bala haholoanyane

Potso ea 753. Tharollo e Tloaelehileng ea Mofuta oa Leetcode Polelo ea Bothata The Custom Sort String LeetCode Solution – “Custom Sort String” e bolela hore u fuoa taelo ea likhoele tse peli le s. Litlhaku tsohle tsa tatellano ea likhoele li ikhethile 'me li hlophisoa ka tatellano e tloaelehileng. Re hloka ho lumella litlhaku tsa s le hore libapali li latele ...

Bala haholoanyane

Potso ea 754. 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 755. Bonyane Palo ea Li-Integer tse Ikhethang ka mor'a K Removals Leetcode Solution Polelo ea Bothata Palo e Nyenyane ea Linomoro tse Ikhethang ka mor'a K Removals LeetCode Tharollo - "Bonyane Palo e Ikhethileng ea Linomoro ka mor'a ho tlosoa ha K" e bolela hore u filoe lenane la lipalo le palo e feletseng k. Fumana palo e nyane haholo ea linomoro tse ikhethang ka mor'a ho tlosa likarolo tsa k hantle. Mohlala: Kenyeletso: arr = [5,5,4], k = 1 Sephetho: 1 Tlhaloso: Ho tloha k ...

Bala haholoanyane

Potso ea 756. Tlosa Liketsahalo Tsohle tsa Tharollo ea Substring LeetCode Phatlalatso ea Bothata Tlosa Liketsahalo Tsohle tsa Tharollo ea LeetCode ea Substring -"Tlosa Liketsahalo Tsohle tsa Sebopeho sa Substring" se bolela hore ho tlosa LINTHO TSOHLE tsa karolo ea substring ho tloha ho s. Tlhokomeliso: Substring ke tatellano e hlakileng ea litlhaku ka khoele ea ho kenya. Mohlala oa Tlhaloso Ha re...

Bala haholoanyane

Potso ea 757. 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 758. 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 759. 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 760. 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 761. 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 762. Sheba Haeba Array Pairs li Aroha ka k LeetCode Solution Problem Statement Hlahloba Haeba Array Pairs Li Arohanoa ke k LeetCode Tharollo - Ho fanoe ka palo ea palo e lekanang le bolelele ba n le palo e feletseng k. Re batla ho arola sehlopha ka lipara tsa n/2 hantle hore kakaretso ea para ka 'ngoe e aroloe ka k. Khutlisa 'nete Haeba ...

Bala haholoanyane

Potso ea 763. Hlopha Litlhaku ho ea ka Frequency LeetCode Tharollo Phatlalatso ea Bothata Hlophisa Litlhaku Ka Frequency LeetCode Tharollo - Ho fanoe ka khoele ea S, e hlophise ka tatellano e fokotsehang ho latela makhetlo a litlhaku. Khafetsa ea tlhaku ke palo ea makhetlo a hlahang khoeleng. Khutlisetsa khoele e hlophisitsoeng. Haeba ho na le likarabo tse ngata, khutlisetsa e 'ngoe ea tsona. Mohlala oa ho Hlopha Litlhaku Ka ...

Bala haholoanyane

Potso ea 764. 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 765. 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 766. Factorial Trailing Zeroes LeetCode Tharollo Phatlalatso ea Bothata Factorial Trailing Zeroes LeetCode Tharollo - Ho fanoe ka palo e feletseng n, khutlisetsa palo ea li-zero tse latelang ka n!. Hlokomela hore n! = n * (n - 1) * (n - 2) * ... * 3 * 2 * 1. Kenyelletso: n = 3 Sephetho: 0 Tlhaloso: 3! = 6, ha ho na morao ...

Bala haholoanyane

Potso ea 767. 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 768. 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 769. Nako e Nyenyane ea ho Qoba ho Finyella Lehae la LeetCode Tharollo Polelo ea Bothata Nako e Nyenyane ho Fihla Lehae Tharollo ea LeetCode e re – Lehae la kokoanyana e itseng le ho x-axis boemong ba x. Ba thuse hore ba fihle moo ho tloha boemong ba 0. Sekokoanyana se qhomela ho latela melao e latelang: E ​​ka qhomela hantle ka tsela e eang pele (ka ho le letona). E ka qhomela hantle maemong a b ka morao (ho ea ...

Bala haholoanyane

Potso ea 770. 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 771. Molemo ka ho Fetisisa oa Ntlha ea Kopano LeetCode Tharollo Polelo ea Bothata The Best Meeting Point LeetCode Solution e re Ho fanoe ka marang-rang a binary a boholo ba mxn moo e mong le e mong a khethang lehae la motsoalle a le mong, re batla ho khutlisetsa sebaka se fokolang sa maeto moo kakaretso ea sebaka sa maeto e leng kakaretso ea libaka tse pakeng tsa matlo. ea...

Bala haholoanyane

Potso ea 772. Molumo o molelele ka ho Fetisisa o nang le Bonyane Tharollo ea Litlhaku tse Phetang tsa K tsa LeetCode Problem Statement The problem Substring e telele ka ho fetesisa e nang le Bonyane K e Phetang Litlhaku LeetCode Solution e re ha ho fanoe ka khoele S le palo e felletseng ea k, ho khutlisa bolelele ba khoele e telele ka ho fetisisa ea S hoo maqhubu a tlhaku e 'ngoe le e 'ngoe a le kholo ho feta kapa a lekana le k. . Mohlala oa Substring e Telele ka Bonyane ...

Bala haholoanyane

Potso ea 773. 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 774. Kth Nomoro e Nyane ka ho Fetisisa Tafoleng ea Leetcode Tharollo Phatlalatso ea Bothata Nomoro e Nyenyane ka ho Fetisisa ea Kth ho Tharollo ea Letlapa la Katiso - e bolela hore u fuoa matrix ea tafole ea ho atisa boholo ba mxn, moo matrix [i] [j] = i * j (1 indexed). Bakeng sa linomoro tse tharo tse fanoeng ke m,n le k, re hloka ho fumana kth ntho e nyane ka ho fetisisa ho m ...

Bala haholoanyane

Potso ea 775. 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 776. 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 777. Kakaretso ea Subarray Ranges Leetcode Tharollo Polelo ea Bothata Kakaretso ea Subarray Ranges Leetcode Solution - e re u fuoa palo e felletseng ea boholo ba boholo ba 10^3. Re hloka ho khutlisa kakaretso ea mefuta eohle ea li-subarray tsa mefuta e fanoeng. Mefuta e fapaneng ea subarray e hlalosoa e le phapang lipakeng tsa tse kholo le tse nyane ...

Bala haholoanyane

Potso ea 778. 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 779. E kholo ka ho fetisisa ea BST Subtree LeetCode Tharollo Polelo ea Bothata Bothata bo boholo ka ho fetisisa ba BST Subtree LeetCode Tharollo bo re ho fanoe ka motso oa sefate sa binary, fumana subtree e kholo ka ho fetisisa, eo hape e leng Binary Search Tree (BST), moo e kholo ka ho fetisisa e bolelang subtree e nang le palo e kholo ka ho fetisisa ea li-node. Tlhokomeliso: Sefate se senyenyane se tlameha ho kenyelletsa litloholo tsohle tsa sona. Ka Binary ...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 781. Hlopha Array Ka Parity LeetCode Tharollo Polelo ea Bothata Ho Hlopha Array Ka Parity LeetCode Tharollo - "Hlopha Array Ka Parity" e bolela hore u fuoa palo e felletseng ea palo, tsamaisa palo e felletseng qalong ea lethathamo le lateloang ke linomoro tse sa tloaelehang. Tlhokomeliso: Khutlisetsa sehlopha sefe kapa sefe se khotsofatsang boemo bona. Mohlala: Kenyeletso: Sephetho: ...

Bala haholoanyane

Potso ea 782. Tlosa Node ea Nth Ho tloha Qetellong ea Tharollo ea Leetcode Phatlalatso ea Bothata Tlosa Node ea Nth Ho tloha Qetellong ea Lethathamo la Leetcode Tharollo - e bolela hore u fuoa hlooho ea lenane le amanang le eona 'me u hloka ho tlosa node ea nth ho tloha qetellong ea lenane lena. Kamora ho hlakola node ena, khutlisetsa hlooho ea lenane le fetotsoeng. Mohlala: Kenyelletso:...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 784. Subarray Sum E lekana le Tharollo ea K LeetCode Polelo ea Bothata The Subarray Sum Equals K LeetCode Solution – “Subarray Sum Equals K” e bolela hore o fuoa palo e felletseng ea “nomoro” le palo e felletseng 'k', e khutlisa kakaretso ea palo ea lihlopha tse tsoelang pele tseo kakaretso ea tsona e lekanang le 'k'. Mohlala: lipalo = [1, 2, 3], k=3 2 Tlhaloso: Ho na le ...

Bala haholoanyane

Potso ea 785. 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 786. 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 787. 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 788. 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 789. 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 790. 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 791. 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 792. Bonyane ba Tsamaiso ea Tekano ea Likarolo tsa Leetcode Solution Polelo ea Bothata bothateng bona, re fuoa mefuta e mengata ea linomoro. Hape, re lumelloa ho etsa mefuta e itseng ea ts'ebetso ho sehlopha sena. Ketsahalong e le 'ngoe, re ka nyolla "n - 1 ″ (likarolo tsohle ntle le eng kapa eng) likarolo tse ka har'a sehlopha ka 1. Re hloka ho ...

Bala haholoanyane

Potso ea 793. 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 794. Bala li-Node tse Ntle ho Binary Tree Leetcode Tharollo Polelo ea Bothata Bothateng bona ho fanoa ka sefate sa binary ka motso oa sona. Node X sefateng e reiloe hantle haeba tseleng e tlohang motso ho isa X ha ho na li-node tse nang le boleng bo fetang X. Re tlameha ho khutlisa palo ea li-node tse ntle ho ...

Bala haholoanyane

Potso ea 795. Palo ea Mehato ea ho Fokotsa Nomoro ho Tharollo ea Zero Leetcode Bothata Palo ea Mehato ea ho Fokotsa Nomoro ho Zero Leetcode Solution e re e fuoe palo e felletseng. Fumana palo e tlase ea mehato ea ho fetolela palo e fuoeng ho 0. U ka etsa e 'ngoe ea mehato e' meli, ekaba u ntše 1 kapa u arole palo e kholo ka 2. Bothata ...

Bala haholoanyane

Potso ea 796. Tharollo ea Leetcode Tharollo ea ho paka makoloi Polelo ea Bothata Bothateng bona, re tlameha ho rala sebaka sa ho paka makoloi. Re na le mefuta e 3 ea libaka tsa ho paka makoloi (tse kholo, tse mahareng le tse nyane). Libaka tsena tsohle tsa ho paka makoloi li na le palo e lekantsoeng ea libaka tse se nang letho qalong. Joalo, ka mofuta o moholo oa sebaka, re ka beha boholo ba likoloi tsa b. Ka nyane ...

Bala haholoanyane

Potso ea 797. 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 798. Mateano a litsela tsa tse peli tse Arrays II Leetcode Tharollo Polelo ea Bothata Bothateng bona ho fanoa ka mefuta e 'meli' me re tlameha ho fumana mateano a likarolo tsena tse peli ebe re khutlisa sephetho sa sephetho. Karolo ka 'ngoe sephethong e lokela ho hlaha makhetlo a mangata kamoo e bonts'ang ka tatellano ka bobeli. Sephetho se ka ba ka tatellano efe kapa efe. Mohlala ...

Bala haholoanyane

Potso ea 799. 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 800. Abela Tharollo ea Li-cookie Leetcode Bothata Abela li-cookies Tharollo ea Leetcode e fana ka likarolo tse peli. E 'ngoe ea tse fapaneng e emetse boholo ba cookies mme e' ngoe e emela meharo ea bana. Bothata bo re ke uena motsoali oa bana, 'me u batla hore palo e phahameng ea bana e khotsofale. ...

Bala haholoanyane

Potso ea 801. Tharollo ea bongata ba lintho tsa Leetcode Polelo ea Bothata Re fuoa mefuta e mengata ea linomoro. Re hloka ho khutlisa palo e phethahetseng e fetang nako ea ⌊N / 2⌋ ka bongata moo ⌊ ⌋ e leng mosebeletsi oa mokatong. Karolo ena e bitsoa karolo ea bongata. Hlokomela hore sehlopha se kenyang se lula se na le likarolo tse ngata. ...

Bala haholoanyane

Potso ea 802. 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 803. 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 804. Boholo ba Botebo ba Tharollo ea Leetcode ea Sefate sa N-ary Bothateng bona, re fuoa sefate sa N-ary, ke hore, sefate se lumellang li-node ho ba le bana ba fetang 2. Re hloka ho fumana botebo ba lekhasi hole le motso oa sefate. Sena se bitsoa botebo bo boholo. Hlokomela hore botebo ba tsela ...

Bala haholoanyane

Potso ea 805. 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 806. 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 807. 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 808. Kenya ka hare ho Binary Search Tree Leetcode Tharollo Bothateng bona, re fuoa motso oa sefate sa Binary Search se nang le litekanyetso tsa palo e felletseng le boleng bo lekantsoeng ba node eo re tlamehang ho e eketsa ho Binary Search Tree le ho khutlisa sebopeho sa eona. Kamora ho kenya karolo ho BST, re tlameha ho e hatisa ...

Bala haholoanyane

Potso ea 809. 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 810. 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 811. Bonyane ba Botebo ba Tharollo ea Binary Tree Leetcode Bothateng bona, re hloka ho fumana bolelele ba tsela e khuts'oane ho tloha motso ho ea ho lekhasi lefe kapa lefe sefateng sa binary. Hlokomela hore "bolelele ba tsela" mona bo bolela palo ea li-node ho tloha motso oa motso ho ea node ea lekhasi. Bolelele bona bo bitsoa Bonyane ...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 813. 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 814. Sqrt (x) Tharollo ea Leetcode Joalokaha sehlooho se bolela, re hloka ho fumana motso o sekwere oa palo. Ha re re nomoro ke x, ebe Sqrt (x) ke nomoro e joalo ka hore Sqrt (x) * Sqrt (x) = x. Haeba motso o sekwere oa nomoro e le boleng bo itseng ba decimal, joale re tlameha ho khutlisa boleng ba fatše ba ...

Bala haholoanyane

Potso ea 815. 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 816. Fetola li-Node ho Li-Leetcode Solutions tsa Pairs Morero oa bothata bona ke ho chencha li-node tsa lenane le hokahanngoeng ka bobeli, ke hore, ho fapanyetsana li-node tse ling tse peli tse haufi. Haeba re lumelloa ho chencha boleng ba linomoro feela, bothata bo ka ba bobebe. Kahoo, ha rea ​​lumelloa ho fetola node ...

Bala haholoanyane

Potso ea 817. Tharollo ea House Robber Leetcode Polelo ea Bothata Bothateng bona ho na le matlo seterateng mme lesholu la matlo le tlameha ho utsoetsa matlo ana. Empa bothata ke hore a ke ke a utsoetsa ntlo e fetang e le 'ngoe ka tatellano, ke hore, e haufi le e' ngoe. Ho fanoe ka lenane la linomoro tse se nang bobe tse emelang chelete ...

Bala haholoanyane

Potso ea 818. 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 819. Li-Anagrams tse Sebetsang Bothateng "Li-Anagrams tse Sebetsang" re fane ka likhoele tse peli str1 le str2. Fumana hore likhoele ka bobeli ke anagrams kapa che. Haeba li anagrams li khutlisa 'nete, khutla hape. Keletso ea Mohlala: str1 = "abcbac" str2 = "aabbcc" Sephetho: Tlhaloso ea 'nete: Kaha str2 e ka theoa ka ho hlophisa bocha ...

Bala haholoanyane

Potso ea 820. Lethathamo le kopaneng Ho fanoe ka sehlopha se nang le linomoro tsa 0 le tsa 1 feela. Re tlameha ho fumana bolelele ba sehlopha se selelele ka ho fetesisa se nang le o le 1 ka ho lekana. Mohlala Input arr = [0,1,0,1,0,0,1] Tlhaloso 6 Tlhaloso Sehlopha se selelele ka ho fetesisa se tšoailoeng ka 'mala o mofubelu [0,1,0,1,0,0,1] le bolelele ba sona ke 6. Algorithm Set ...

Bala haholoanyane

Potso ea 821. Union le mateano a litsela tse peli tse hokahaneng Ha u fuoa manane a mabeli a hokahaneng, theha manane a mang a mabeli a hokahaneng ho fumana bonngoe le liphapano tsa likarolo tsa manane a teng. Ho kenya mohlala: Lethathamo1: 5 → 9 → 10 → 12 → 14 Lethathamo2: 3 → 5 → 9 → 14 → 21 Sephetho: Intersection_list: 14 → 9 → 5 Union_list: ...

Bala haholoanyane

Potso ea 822. Lemonade Fetola Leetcode Tharollo Mantsoe ana a ho Lemonade Change Leetcode Solution Bothata ba polelo Bothateng "Lemonade Change" ho na le lethathamo la bareki. Ba batla ho reka lemonade ho rona e jang li-rupee tse 5. Bareki ba ka re fa li-rupee tse 5, tse 10 kapa tse 20. Re batla ho khutlisa ...

Bala haholoanyane

Potso ea 823. Tharollo e sebetsang ea Leetcode e sebetsang hantle Mantsoe ana a ho Valid Perfect Square Leetcode Solution Bothata ba polelo Bothateng "Valid Perfect Square" re fuoa nomoro "num" mme re hloka ho sheba hore na nomoro ena ke sekwere se phethahetseng kapa che. Re tlameha ho sheba sena ntle le ho sebelisa ts'ebetso e hahelletsoeng ka hare ho sqrt. Haeba ...

Bala haholoanyane

Potso ea 824. Kemiso ea Round Robin Ho hlophisoa ha Round Robin ho ts'oana haholo le FCFS. Phapang e le 'ngoe lipakeng tsa kemiso ea RR le FCFS ke hore, RR ke kemiso ea boikhethelo athe FCFS ke kemiso e sa reroang. Ts'ebetso e ngoe le e ngoe e fuoa CPU moleng o loketseng bakeng sa selae sa nako e le 'ngoe. Mona, mola o loketseng o ts'oana le ...

Bala haholoanyane

Potso ea 825. Palo e phahameng ea likarolo tsa bolelele a, b le c Bothata "Boholo ba likarolo tsa bolelele a, b le c" bo re o filoe palo e nepahetseng ea N, 'me o hloka ho fumana palo e phahameng ea likarolo tsa bolelele a, b, le c tse ka thehoang ho sebelisoa N. Mohlala N = 7 a = 5, b ...

Bala haholoanyane

Potso ea 826. 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 827. Lipalo tsa bolelele bo fanoeng moo karolo e ngoe le e ngoe e fetang kapa e lekanang habeli ea pejana Bothata "tatellano ea bolelele bo fanoeng moo karolo e ngoe le e ngoe e fetang kapa e lekanang le makhetlo a mabeli a fetileng" e re fa linomoro tse peli m le n. Mona m ke palo e kholo ka ho fetisisa e ka bang teng ka tatellano mme n ke palo ea likarolo tse lokelang ho ba teng ho ...

Bala haholoanyane

Potso ea 828. Bala litsela tsa ho fihlela litepisi tsa nth u sebelisa mohato oa 1, 2 kapa 3 Bothata "Bala litsela tsa ho fihlella stair u sebelisa mohato oa 1, 2, kapa 3" e re o eme fatše. Hona joale o hloka ho fihla qetellong ea litepisi. Joale ho na le litsela tse kae tsa ho fihla qetellong haeba u ka tlolela 1, 2, ...

Bala haholoanyane

Potso ea 829. Fumana postorder ho haola ha BST ho tloha esale pele ho parola Polelo ea Bothata Bothata "Fumana tsela e tsamaeang ka pele ea BST ho tloha ha u rera esale pele" e re o fuoe ho otlolla pele ho sefate sa lipatlisiso tsa binary. Ebe u sebelisa lintlha tse fanoeng, fumana mokhoa oa poso o tsamaeang. Mohlala esale pele tatellano ea ho parola: 5 2 1 3 4 7 6 8 9 1 4 3 2 ...

Bala haholoanyane

Potso ea 830. Bala esita le bolelele ba tatellano ea binary ka chelete e lekanang ea likotoana tsa halofo ea pele le ea bobeli Bothata "Bala esita le bolelele ba tatellano ea binary ka chelete e lekanang ea likotoana tsa halofo ea pele le ea bobeli" e re o filoe palo e felletseng. Joale fumana palo ea mekhoa ea ho aha tatellano ea binary ea boholo ba 2 * n hoo halofo ea pele le halofo ea bobeli li nang le palo e lekanang ...

Bala haholoanyane

Potso ea 831. Hatisa Boholo ba Bolelele ba Liipara Polelo ea Bothata Bothata "Hatisa boholo ba bolelele ba lipara" ho bolela hore o filoe lipalo tse 'maloa. Ho fanoe hore ka bobeli, nomoro ea pele e nyane ho ea palo ea bobeli. Joale o hloka ho fumana ketane e telele ka ho fetesisa hoo palo ea bobeli e fetileng ...

Bala haholoanyane

Potso ea 832. Hatisa mantsoe a Newman-Conway Sequence Polelo ea Bothata Bothata "Print n terms of Newman-Conway Sequence" e re o fuoe palo e felletseng "n". Fumana mantsoe a pele a Newman-Conway Sequence ebe u a hatisa. Mohlala n = 6 1 1 2 2 3 4 Tlhaloso Mantsoe ohle a hatisitsoeng a latela tatellano ea Newman-Conway ...

Bala haholoanyane

Potso ea 833. Tlosa Likopi ho tsoa Lenaneng la II Bothata "Tlosa Likopi ho Lethathamo la Lihlopha tsa Bobeli" e re o filoe lethathamo le hokahaneng le ka bang le lintho tse tšoanang kapa tse se nang tsona. Haeba lethathamo le na le likarolo tse kopilitsoeng ebe o tlosa maemo ohle a bona lenaneng. Kamora ho etsa ts'ebetso e latelang, hatisa lenane le hokahaneng ho ...

Bala haholoanyane

Potso ea 834. Ngola mosebetsi ho fumana sebaka sa mateano a litsela tse peli tse hokahaneng Polelo ea Bothata Bothata "Ngola mosebetsi ho fumana sebaka sa mateano a litsela tse peli tse hokahantsoeng" e re o fuoe manane a mabeli a hokahaneng. Empa ha se manane a ikemetseng a hokahaneng. Li hokahane ka nako e ngoe. Joale o hloka ho fumana ntlha ena ea liphapano tsa manane ana a mabeli. ...

Bala haholoanyane

Potso ea 835. Tatellano ea Newman-Conway Polelo ea Bothata Bothata "tatellano ea Newman-Conway" e re o fuoe palo e kenyelletsoeng ea "n". Ebe o hloka ho printa karolo ea pele ea nth ea Sequence ea Newman-Conway. Mohlala n = 6 4 n = 10 6 Tlhaloso Ho tloha ha likarolo tsa tlhahiso li emela karolo ea botšelela le ea leshome ea Newman-Conway ...

Bala haholoanyane

Potso ea 836. 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 837. Hatisa tatellano ea Fibonacci u sebelisa mefuta e 2 Polelo ea Bothata Bothata "Hatisa tatellano ea Fibonacci u sebelisa mefuta e 2" e re o hloka ho hatisa tatellano ea Fibonacci empa ho na le moeli oa ho sebelisa mefuta e 2 feela. Mohlala n = 5 0 1 1 2 3 5 Tlhaloso Sekhetho se hlahisoang se na le likarolo tsa pele tse hlano tsa ...

Bala haholoanyane

Potso ea 838. Ho Khaola Molamu Polelo ea Bothata Bothata "Ho khaola molamu" e re o fuoa thupa ea bolelele bo itseng le litheko tsa boholo ba lithupa tse nyane ho feta kapa tse lekanang le bolelele ba ho kenya. Ke hore re tseba theko ea lithupa tsa bolelele ho tloha 1 ho ea ho n, ha re nahana ...

Bala haholoanyane

Potso ea 839. Sehlopha se seholohali se arohaneng Polelo ea Bothata Bothata "Sehlopha se seholo ka ho fetisisa se arohaneng" se re o filoe lethathamo la likarolo tse ikhethang. Fumana bolelele ba kholo ka ho fetisisa hoo para e 'ngoe le e' ngoe ea subset e nang le likarolo tse kholo tse arohanngoang ke likaroloana tse nyane. Mohlala array = {1, 2, 4, 5, 8, 9, 16} 5 ...

Bala haholoanyane

Potso ea 840. Hlahloba hore na ho na le linako tse peli tse arohanang nakong ea likhaohano tse fanoeng Polelo ea Bothata Bothata "Hlahloba hore na ho na le linako tse ling tse peli tse lekanang pakeng tsa linako tse ling" e re u fuoe linako tse ling. Nako ka 'ngoe e na le litekanyetso tse peli, e' ngoe ke nako ea ho qala 'me e' ngoe ke nako ea ho qetela. Polelo ea bothata e botsa ho sheba hore na e na le ...

Bala haholoanyane

Potso ea 841. Bothata ba ho Bapisa Metsoalle Polelo ea Bothata "Bothata ba ho Kopanya Metsoalle" e re ho na le metsoalle ea N. Mme e 'ngoe le e' ngoe ea tsona e ka lula e le masoha kapa ea kopanngoa. Empa hang ha li entsoe, metsoalle eo e 'meli ha e khone ho nka karolo ho e kopanya. Kahoo, o hloka ho fumana palo ea litsela ...

Bala haholoanyane

Potso ea 842. 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 843. 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 844. Bothata ba ho taka Polelo ea Bothata "Bothata ba ho Tiling" e re o na le gridi ea boholo ba 2 x N le thaele ea boholo 2 x 1. Kahoo, fumana palo ea litsela tsa ho tlama gridi e fanoeng. Mohlala 3 2 Tlhaloso: Mokhoa oa ho rarolla bothata Re ka rarolla bothata bona ka ho sebelisa boits'oaro. ...

Bala haholoanyane

Potso ea 845. Maqheka a Phetolo ea Leqephe ho Sisteme ea Ts'ebetso Phetolo ea Leqephe ke eng? Mekhoa ea sejoale-joale ea ts'ebetso e sebelisa paging bakeng sa taolo ea memori mme makhetlo a mangata ho na le tlhoko ea ho nkeloa sebaka ke leqephe. Ho nkela leqephe sebaka ke mokhoa oa ho khutlisa leqephe le teng hona joale mohopolong ka leqephe le hlokahalang empa le le sieo ho ...

Bala haholoanyane

Potso ea 846. Lethathamo la Lenane le amanang Polelo ea Bothata "Bothata ba Lenane le Amanang" bothata bo re o fuoa lenane le hokahaneng. Fumana hore na e na le sekonopo kapa che? Lethathamo le hokahaneng le potoloho Mohlala 1-> 2-> 3 Ha ho Tlhaloso ea Loop: Lenane le hokahaneng ha le na sekonopo hobane haeba le ne le ka ba teng ka nako eo ho ne ho ka be ho se na tse peli tse sa ...

Bala haholoanyane

Potso ea 847. Bothata ba ho Hlahisa Boolean Polelo ea Bothata "Boolean Parenthesization Bothata" e re re fuoe tatellano ea 'nete le bohata, mme ba bang ba li-boolean operators (LE, OR, XOR) lipakeng tsa bona. Re hloka ho fumana palo ea mekhoa ea ho hlophisa tatellano e fanoeng e le hore tatellano eohle e felle ka 'NETE. Ka ...

Bala haholoanyane

Potso ea 848. 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 849. Mokhoa oa ho hatisa palo e phahameng ea li-A ha u sebelisa linotlolo tse 'ne Polelo ea Bothata Tsela ea ho hatisa palo e phahameng ea li-A ha u sebelisa linotlolo tse 'ne tse fanoeng, bothata bona bo re o na le khetho ea ho khetha senotlolo seo o tla se tobetsa. Linotlolo li etsa mesebetsi e latelang: Key1 - Prints 'A' skrineng Key2 - Khetha skrineng kaofela. Key3 - Kopitsa tse khethiloeng ...

Bala haholoanyane

Potso ea 850. Bala lintho tse tloaelehileng lethathamong ka bobeli empa ka litheko tse fapaneng Polelo ea Bothata U fuoa manane a mabeli. E 'ngoe le e' ngoe ea index e na le lebitso la ntho eo le theko ea eona. Polelo ea bothata e kopa ho bala lintho tse tloaelehileng lethathamong ka bobeli empa ka litheko tse fapaneng, e leng ho fumana hore na ke lipalo tse kae tsa lintho tse tloaelehileng ho tsona ka bobeli ...

Bala haholoanyane

Potso ea 851. Tharollo ea Space Optimized DP bakeng sa Bothata ba 0-1 ba Knapsack Polelo ea Bothata Re fuoa mokotla o ka tšoarellang, re hloka ho khetha tse ling tsa lintho tse fanoeng ka boleng bo itseng. Lintho li lokela ho khethoa molemong oa hore boleng ba mokotla (boleng bo felletseng ba lintho tse nkuoeng) bo holisoe. ...

Bala haholoanyane

Potso ea 852. 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 853. Ho kh'outa ha Huffman Re na le molaetsa oo re batlang ho o fetisa. Re batla hore molaetsa o be bonyane ka bonyane molemong oa hore litšenyehelo tse bileng teng ha ho romelloa molaetsa li le tlase. Mona re sebelisa mohopolo oa Huffman Coding ho fokotsa boholo ba molaetsa. Ha re nke hore re na le ...

Bala haholoanyane

Potso ea 854. Moralo oa Sebopeho sa data Ho mamela Moralo oa Sebopeho sa Datha, Batho ba bangata ba kanna ba batla ho baleha ba shebile sehlooho ka bosona. Ba ntsebang baa tseba hore ha ke tlohe ho fihlela ke hlalosa mohopolo ka botlalo. Nka leetong la ho ithuta bothata le mehopolo e 'maloa ho ...

Bala haholoanyane

Potso ea 855. 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 856. 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 857. Fetola Node Ka Lipara Ho li-swode node ka bothata ba lipara, re fane ka lenane le hokahaneng le nang le li-node. Fetola node e 'ngoe le e' ngoe esita le index e nepahetseng e haufi le index e sa tloaelehang () ha u nahana ka index e qalang ho tloha ho 0. Mohlala Input: 1-> 2-> 3-> 4-> NULL Output: 2-> 1-> 4-> Kenyelletso ea 3-> NULL: 1-> 2-> 3-> 4-> 5-> 6-> 7-> Tlhahiso ea NULL: 2-> 1-> 4-> 3-> 6-> 5-> 7- > NULL Iterative Method Algorithm Etsa ...

Bala haholoanyane

Potso ea 858. Tsela e fapaneng ea li-Arrays tse peli Mathateng a liphapano tsa mathata a mabeli, re fane ka li-arrays tse peli, re hloka ho hatisa liphapano tsa tsona (lintho tse tloaelehileng). Mohlala Input arr1 [] = {1, 2, 2, 1} arr2 [] = {2, 2} Sephetho {2, 2} Input arr1 = {4, 9, 5} arr2 = {9, 4, 9, 8 , 4} Tlhahiso ea {4, 9} Algorithm ...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 860. Tharollo ea Sudoku Bothateng ba tharollo ea sudoku re fane ka sudoku e tlatsitsoeng ka mokhoa o sa fellang (9 x 9), ngola lenaneo ho phethela selotho. Sudoku e tlameha ho khotsofatsa thepa e latelang, Nomoro e ngoe le e ngoe (1-9) e tlameha ho hlaha hang hang ka tatellano mme hang ka kholomong. Nomoro e 'ngoe le e' ngoe (1-9) e tlameha ho hlaha hang hang ho ...

Bala haholoanyane

Potso ea 861. MiniMax algorithm E mong le e mong a ka ipotsa. Argh, e 'ngoe hape e ncha ea MINIMAX ALGORITHM. Hobaneng ha re e hloka? Ha re tsebe ho bapala papali ea chess kapa tic-tac-toe hangata re kile ra ipotsa hore na ho na le algorithm ea ho hapa papali. Tlhaloso Linako tse ngata re kanna ra ipotsa hore na ebe ho khonahala ho ...

Bala haholoanyane

Potso ea 862. Kakaretso e lebisitsoeng "Target Sum" ke bothata bo ikhethileng bakeng sa DPHolics tsohle tseo ke nang le tsona kajeno. Ha ho na lebaka la ho tšoenyeha ke tlo tlohella babali ba ka ba bang ba ratehang. Kaofela ha rona re fetile bothateng ba khale ba KnapSack moo re lekang ho fumana palo e phahameng ea ...

Bala haholoanyane

Potso ea 863. Ho bala likotoana Tsohle ka ho bala Bits! Batho ba na le bothata ba ho buisana le likhomphutha tseo ba li entseng. Hobane'ng? Batho ba bua ebile ba utloisisa puo eo ba tlileng ho e bua le ho e mamela ho theosa le lilemo empa ba rutile likhomphutha tse futsanehileng tsa 0 le 1's. Joale kajeno, ha re rute komporo ea rona ho bala ...

Bala haholoanyane

Potso ea 864. 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 865. OSI Model Moetso ona o ntlafalitsoe ka 1983 ke International Standards Organisation (ISO). Ona e bile mohato oa pele o ileng oa nkuoa ho tiisa melaoana ea machabeng e sebelisoang likarolong tse fapaneng. Ha e sebetsana le ho hokela litsamaiso tse bulehileng, ke hore, litsamaiso tse bulehileng bakeng sa puisano le lits'ebetso tse ling, mohlala o bitsoa ...

Bala haholoanyane

Potso ea 866. Nth Catalan Nomoro Bothateng ba nomoro ea Nth Catalan, re fane ka palo e felletseng n. Fumana linomoro tsa pele tsa Catalan. Linomoro tsa Catalan ke letoto la linomoro tse ntle tse bonoang mathateng a mangata a ho bala. Li sebelisetsoa ho bala - BSTs (Lifate tsa lipatlisiso tsa Binary) tse nang le linotlolo. Mefuta e meng ea lekhoakhoa ...

Bala haholoanyane

Potso ea 867. 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 868. Fumana Median ho tsoa ho data Stream Ho Find Median ho tsoa bothateng ba data Stream, re fane ka hore linomoro li baloa ho tsoa molatsoaneng oa data. Fumana bohare ba likarolo tsohle tse baliloeng ho fihlela joale ho qala ka lenane la pele ho fihlela lenaneng la ho qetela. Mohlala Input 1: stream [] = {3,10,5,20,7,6} Sephetho: 3 6.5 ...

Bala haholoanyane

Potso ea 869. Motlatlapi oa Ntlo The House Robber Problem e re, tikolohong ea toropo, ho na le mola o le mong oa matlo. Lesholu le rera ho nka heist sebakeng sena. Oa tseba hore na ho patiloe khauta e kae ntlong ka 'ngoe. Leha ho le joalo, molemong oa ho qoba ho baka ...

Bala haholoanyane

Potso ea 870. Sliding Window Boholo Bothateng ba Sliding Window Maximum re fane ka li-nums, bakeng sa fensetere e 'ngoe le e' ngoe ea boholo ba k, fumana palo e phahameng ea fensetere. Mehlala ea ho kenya linomoro [] = {1,3, -1, -3,5,3,6,7} k = 3 Sephetho {3,3,5,5,6,7} Tlhaloso Mokhoa o sa Tsebeng oa ho Sliding Window Boholo Bakeng sa fensetere e 'ngoe le e' ngoe ea boholo ba k, e tšela ...

Bala haholoanyane

Potso ea 871. 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 872. Sebaka sa Hamming Sebaka sa Hamming ke eng? Sebaka sa Hamming se hlalosoa ka botebo e le palo ea likotoana tse maemong a ts'oanang tse fapaneng ka lipalo tse peli. Ha re hlahlobeng tsela e ncha ea ho fumana sebaka se lipakeng tsa linomoro tse peli. Input ea mohlala Ho fumana sebaka sa hamming lipakeng tsa 4 le 14 4 le ...

Bala haholoanyane

Potso ea 873. Phetolelo ea Pele e Mpe Kaofela ha rona re utloile polelo e reng "Apple e Mpe e Senya Sehlopha" .First Bad Version ke bothata bo bonts'ang hantle se tšoanang. Kajeno re na le bothata e leng First Bad Version. E mong oa baithuti ba sekolo o entse boitlamo bo bobe ka nth ka lebaka la hore ho tloha ho n + 1 kaofela e bile ...

Bala haholoanyane

Potso ea 874. Algorithm ea Kruskal Kruskal Algorithm ke eng? Algorithm ea Kruskal e sebelisetsoa ho fumana sefate se fokolang (MST) sa graph e hokahaneng le e sa tobang. Mohlala oa Graph Graph Minimum Spanning Tree (MST) Algorithm Kruskal's algorithm ke algorithm e meharo ea ho fumana sefate se fokolang. Hlophisa mathoko ho nyoloha ka tatellano ho latela boima ba 'ona. Ho tsohle ...

Bala haholoanyane

Potso ea 875. 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 876. 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 877. 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 878. Kopanya Mofuta Mofuta oa ho kopanya ke eng? Merge Sort ke Tsamaiso e Ikemetseng. Hape ke karohano ebile e hlola algorithm. Joale re hloka ho tseba hore na arola le ho hlola algorithm ke eng? Ke mofuta oa ts'ebetso eo ka eona re arolang bothata ka likhathatso tse nyane ebe re li arola ho fihlela re fumana tse khutšoane haholo ...

Bala haholoanyane

Potso ea 879. Sudoku e sebetsang Valid Sudoku ke bothata boo ho bona re faneng ka boto ea 9 * 9 Sudoku. Re hloka ho fumana Sudoku eo re e filoeng e nepahetse kapa che ho latela melao e latelang: Mokha o mong le o mong o tlameha ho ba le linomoro tsa 1-9 ntle le ho pheta-pheta. Kholomo ka 'ngoe e tlameha ho ba le linomoro tsa 1-9 ntle le ho pheta-phetoa. E 'ngoe le e' ngoe ea mabokose a 9 3x3 ...

Bala haholoanyane

Potso ea 880. Karohano ea Palindrome Karolo ea Palindrome ke bothata ba DP. Bothateng bona, ho filoe khoele S. Partition S hoo mohala o mong le o mong oa karohano e leng palindrome. Re hloka ho hatisa ho fokotsa ho fokolang ho hlokahalang bakeng sa karohano ea palindrome ea S. Input Format Ke mohala o le mong o nang le khoele S. Output Format ...

Bala haholoanyane

Potso ea 881. Kenya linomoro tse peli Ho eketsa linomoro tse peli ke bothata moo re faneng ka lethathamo le kopaneng le se nang letho le emelang palo e felletseng. Linomoro li bolokiloe ka tatellano e fapaneng mme node e ngoe le e ngoe e tlameha ho ba le palo e le 'ngoe feela. Kenya linomoro tse peli ebe u printa sephetho ka ho sebelisa lenane le hokahaneng. Mofuta oa Keketso ...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 883. Bothata ba mofumahali Bothata ba mofumahali ba N ho sebelisa mohopolo oa Backtracking. Mona re beha mofumahali hoo ho seng mofumahali ea tlasa boemo ba tlhaselo. Boemo ba bofumahali ba mafumahali ke ha bo-mofumahali ba babeli ba le kholomong e le 'ngoe, moleng, le ho lekana joale ba ntse ba hlaseloa. Ha re boneng sena ka setšoantšo se ka tlase. Mona ...

Bala haholoanyane

Potso ea 884. Alien Dictionary Alien Dictionary ke mofuta oa bothata boo re nang le mantsoe a N mme a hlophisoa ka tatellano ea bukantswe ea bojaki. Re hloka ho fumana tatellano ea litlhaku. Puo ea molichaba e boetse e sebelisoa ka litlhaku tse nyane empa tatellano ea litlhaku e fapane. Ha re bone hore na re ...

Bala haholoanyane

Potso ea 885. Boima ba Lejoe la ho qetela Boima ba Lejoe la ho qetela ke bothata boo ho bona re nang le sehlopha sa majoe se nang le litekanyo tse ntle. Hona joale re etsa mosebetsi ho eona ho fihlela re siea lejoe le le leng kapa re se na lejoe le le leng. Kamehla re khetha majoe a mabeli a nang le boima ba 'mele bo phahameng ka ho fetesisa' me re a pshatla hammoho. Ha re re boima ba eona bo ...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 888. 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 889. Palo e kahodimodimo Length of Chain Pairs Polelo ea Bothata Botelele bo boholo ba lipara tsa liketane tseo re li fileng linomoro tse peli, fumana ketane e telele ka ho fetisisa eo (c, d) e ka latelang (a, b) haeba b <c. Ka lipara tse fanoeng ntlha ea pele e lula e le nyane ho feta ea bobeli. Kakanyo ea Mohlala [{12, 14}, ...

Bala haholoanyane

Potso ea 890. Fumana Pair ka Phapang e Fanoeng Polelo ea Bothata Lethathamong le sa fanoang le sa hlophisoang, fumana likarolo tse peli ka har'a sehlopha se fanoeng ka phapang e fanoeng n. Mohlala Input arr [] = {120, 30, 70, 20, 5, 6}, phapang (n) = 40 Output [30, 70] Tlhaloso Mona phapano ea 30 le 70 e lekana le boleng ba ...

Bala haholoanyane

Potso ea 891. Fumana sekoaelo lenaneng le hokahaneng Polelo ea Bothata Bothateng ba "Fumana sekoaelo lenaneng le hokahaneng" re fane ka lenane le hokahaneng. Fumana hore na ho na le loop kapa che. Haeba ho na le sekgoqetsane lenaneng le hokahaneng joale node e 'ngoe lenaneng le hokahaneng e tla be e supa noutu e' ngoe ea tse fetileng ...

Bala haholoanyane

Potso ea 892. 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 893. Fetola Kth Node ho tloha qalong le Kth Node ho tloha End Polelo ea Bothata Bothateng ba "Swap Kth Node ho tloha qalong le Kth Node ho tloha End", re fane ka lenane le hokahaneng. Fetola node ea kth ho tloha qalong_ka node ea kth ho tloha qetellong. Ha rea ​​lokela ho chencha litekanyetso, re lokela ho chencha litlhahiso. Mohlala 2 1 2 3 4 5 6 1 ...

Bala haholoanyane

Translate »
4