Lipotso tsa Puisano ea Expedia

Lipotso tsa Puisano ea ExpediaPin

Lipotso tsa Expedia 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. 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 3. 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 4. 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 5. 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 6. 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 7. Bala liketsahalo tsohle tse nang le sehlahisoa se ka tlase ho K Bothata "Bala tsohle tse latelang tse nang le sehlahisoa se ka tlase ho K" e re o fuoe lethathamo la linomoro. Hona joale fumana palo ea liphetho tse nang le sehlahisoa se ka tlase ho kenyelletso e fanoeng K. Mohlala a [] = {1, 2, 3, 4, 5} k = 8 Palo ea tse latelang tlase ...

Bala haholoanyane

Potso ea 8. k-th e sieo ka tatellano e ntseng e eketseha e seng teng ka tatellano e fanoeng Bothata "k-th e haellang ea tatellano e ntseng e eketseha e seng teng ka tatellano e fanoeng" e re o fuoe likarolo tse peli. E 'ngoe ea tsona e hlophisitsoe ka tatellano e nyolohang le e' ngoe e tloaelehileng e sa hlophisoang ka palo k. Fumana kth element e sieo e seng teng ka mokhoa o tloaelehileng ...

Bala haholoanyane

Potso ea 9. Hatisa mefuta e mengata e fetotsoeng kamora ts'ebetso e mengata ea likhatiso tse fapaneng Bothata "Printa e fetotsoeng ka mor'a ts'ebetso ea "multiple array increment" e bolela hore o fuoa palo e felletseng mme ho fanoe ka 'q' linomoro tsa lipotso. Palo e le 'ngoe "d" e boetse e fanoe. Potso ka 'ngoe e na le linomoro tse peli, boleng ba ho qala le boleng ba ho qetela. Polelo ea bothata e batla ho fumana ...

Bala haholoanyane

Potso ea 10. Lethathamo la Lipotso tsa lipapatso tse ngata le sehlahisoa Bothata "Lipotso tsa Array bakeng sa ho atisa, tse nkeloang sebaka le sehlahisoa" li re o fuoe lethathamo la linomoro mme ho tla ba le mefuta e meraro ea lipotso, moo o tlamehang ho rarolla mofuta o latelang oa lipotso: Mofuta oa 1: Ho tla ba le litekanyetso tse tharo tse setseng , ho le letona le nomoro X. Ho sena ...

Bala haholoanyane

Potso ea 11. Phapang Array | Potso ea ntlafatso ea mefuta-futa ho O (1) U fuoa mefuta e fapaneng ea lipotso le mefuta e 'meli ea lipotso, e' ngoe ke ho eketsa nomoro e fanoeng ka bongata ebe e 'ngoe e hatisa lenane lohle. Bothata "Phapang ea Lethathamo | Potso ea ntlafatso ea Range ho O (1) ”e hloka hore re etse liapdeite tsa mefuta ho O (1). Mohlala arr [] ...

Bala haholoanyane

Potso ea 12. Nako ea linako tse ling e eketsa ts'ebetso ka bongata O fane ka palo e felletseng mme qalong, e ile ea qalisoa e le 0 hape ea fuoa mefuta. Mosebetsi ke ho kenyelletsa nomoro e fanoeng ka bongata le ho printa sephetho se hlahisoang. Mohlala arr [] = {0, 0, 0, 0, 0} Potso: {(0, 2, 50), (3, ...

Bala haholoanyane

Potso ea 13. Lipotso tse mabapi le XOR tsa selelekisi se sa tloaelehang ka ho fetisisa se fapaneng Polelo ea Bothata Bothata "Queries on XOR of the most oddor divisor of the range" e re o filoe lethathamo la lipotso tse ngata, 'me potso ka' ngoe e na le mokoloko. Polelo ea bothata e kopa ho fumana XOR ea sekhahla se makatsang ka ho fetesisa kahara sebaka se fanoeng ...

Bala haholoanyane

Potso ea 14. Boemo ba mefuta ka tatellano Polelo ea Bothata Bothata "Boema-kepe ba mefuta-futa" bo re o fuoa lenane le kopaneng la lipotso. Potso ka 'ngoe e na le letšehali le ho le letona joalo ka bophara. Polelo ea mathata e kopa ho fumana boleng ba boleng bo tlase ba linomoro tsohle tse kenang ...

Bala haholoanyane

Potso ea 15. Subset ka kakaretso e ka arohanngoang ke m Polelo ea Bothata Bothata "Subset with sum divisible by m" e re o filoe lethathamo la linomoro tse seng mpe le palo e felletseng ea m. Hona joale o hloka ho fumana hore na ho na le sethala se nang le kakaretso e arohanngoang ke m. Ke kakaretso ea subset eo e lokelang ho fana ka eona e le ...

Bala haholoanyane

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

Bala haholoanyane

Potso ea 18. Boholo ba bolelele ba morao bo nang le phapang lipakeng tsa likarolo tse haufinyane joalo ka 0 kapa 1 Polelo ea Bothata O fuoa palo e felletseng. Bothata "Bolelele ba bolelele ba bolelele bo nang le phapang lipakeng tsa likarolo tse haufinyane joalo ka 0 kapa 1" bo kopa ho fumana bolelele bo boholo ba kamora moo le phapang lipakeng tsa likarolo tse haufi ha ea lokela ho ba tse ling ntle le 0 kapa 1. Mohlala arr [] = {1,. ..

Bala haholoanyane

Potso ea 19. Palo e tlase ea likarolo tse khethollang kamora ho tlosa lintho tsa m Polelo ea Bothata Bothata "Linomoro tse nyane tsa likarolo tse khethollang kamora ho tlosa lintho tsa m" li re o na le sehlopha le palo e kholo ea m. Karolo ka 'ngoe ea sehlopha e bontša li-id tsa ntho. Polelo ea mathata e kopa ho tlosa limmitha ka tsela eo ho tla ba le bonyane ...

Bala haholoanyane

Potso ea 20. 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 21. Fumana mela eohle e lumelletsoeng ea mola o fanoeng ka matrix Polelo ea Bothata Fumana mela eohle e lumelletsoeng ea mola o fanoeng ka matrix o re o fuoe matrix ea boholo ba m * n mme nomoro ea mola oa matrix e re 'row'. Polelo ea bothata e kopa ho fumana mela eohle e ka bang teng e leng tumello moleng o fanoeng. Sena ke ...

Bala haholoanyane

Potso ea 22. 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 23. Lipalo tsa Subsets li na le Phapang le Linomoro Kaofela ha rona re na le bothata ba bothata ba subset ka nako e 'ngoe kapa e' ngoe puisanong. Batho ba botsang lipotso le bona ba rata mathata ana. Mathata ana a ba thusa ho lekola kutloisiso hammoho le ts'ebetso ea mohopolo ea moithuti ofe kapa ofe. Kahoo, ntle le ts'ehetso e ngoe, a re tloleleng ka kotloloho ho ...

Bala haholoanyane

Potso ea 24. 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 25. 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 26. 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 27. 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 28. 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 29. 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

Lipotso tsa Likhoele tsa Expedia

Potso ea 30. 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 31. 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 32. 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 33. 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 34. 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 35. 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 36. 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 37. 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 38. 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

Lipotso tsa Sefate sa Expedia

Potso ea 39. 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 40. Palo e tlase ea likarolo tse khethollang kamora ho tlosa lintho tsa m Polelo ea Bothata Bothata "Linomoro tse nyane tsa likarolo tse khethollang kamora ho tlosa lintho tsa m" li re o na le sehlopha le palo e kholo ea m. Karolo ka 'ngoe ea sehlopha e bontša li-id tsa ntho. Polelo ea mathata e kopa ho tlosa limmitha ka tsela eo ho tla ba le bonyane ...

Bala haholoanyane

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

Lipotso tsa Expedia Stack

Potso ea 42. 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 43. 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 44. 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

Lipotso tsa Expedia Matrix

Potso ea 45. 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 46. 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 47. 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 48. 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 49. Fumana likarolo tse ikhethang tse tloaelehileng melaong eohle ea matrix Polelo ea Bothata Re fuoa matrix ea linomoro tsohle. Bothata "Fumana likarolo tse ikhethang tse tloaelehileng melaong eohle ea matrix" e kopa ho fumana likarolo tsohle tse ka khetholloang empa e le tse tloaelehileng molaong o mong le o mong o teng ka har'a matrix. Mohlala arr [] = {{11, 12, 3, 10}, {11, ...

Bala haholoanyane

Potso ea 50. Fumana mela eohle e lumelletsoeng ea mola o fanoeng ka matrix Polelo ea Bothata Fumana mela eohle e lumelletsoeng ea mola o fanoeng ka matrix o re o fuoe matrix ea boholo ba m * n mme nomoro ea mola oa matrix e re 'row'. Polelo ea bothata e kopa ho fumana mela eohle e ka bang teng e leng tumello moleng o fanoeng. Sena ke ...

Bala haholoanyane

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

Expedia Lipotso Tse Ling

Potso ea 52. Phapang e kholo Pakeng tsa Keketseho ea Elements LeetCode Tharollo Polelo ea Bothata Phapang e kholo lipakeng tsa Keketseho ea Elements LeetCode Tharollo - Ho fanoe ka 0-indexed integer array nums ea boholo n, fumana phapang e kholo pakeng tsa nums[i] le nums[j] (ke hore, nums[j] - nums[i]), hoo 0 <= i < j < n le nums[i] < nums[j]. Khutlisetsa phapang e kholo. Haeba ho se na i le j tse joalo, khutlisetsa -1. Mehlala & Litlhaloso Mohlala 1: Kenyelletso: lipalo = [7,1,5,4] Sephetho: 4 Tlhaloso: Phapang e kholo e etsahala ...

Bala haholoanyane

Potso ea 53. 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 54. Reformat Date LeetCode Tharollo Letsatsi la Phetoho ea Phatlalatso ea Bothata LeetCode Tharollo - Ho fanoe ka khoele ea letsatsi ka mokhoa oa Khoeli ea Letsatsi Selemo, moo: Letsatsi le leng teng {"1st", "2nd", "3rd", "4th", ..., "30th", "31th", "1900st"}. Kgwedi e sete ya {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}. Selemo se maemong a fapaneng [2100, XNUMX]. Fetola khoele ea letsatsi...

Bala haholoanyane

Potso ea 55. 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 56. 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 57. 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 58. 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 59. 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 60. 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 61. 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 62. 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 63. 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 64. 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 65. 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 66. 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 67. 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 68. Boholo ba tsela ho Triangle ea Nomoro e Nepahetseng Bothata "Boholo ba tsela ho Triangle ea Linomoro tse Nepahetseng" bo bolela hore o fuoe linomoro tse ling ka sebopeho sa triangolo ea linomoro tse nepahetseng. Fumana chelete e holimo eo u ka e fihlellang haeba u qala holimo 'me u leba motheong hore u tsebe ho tsamaea ...

Bala haholoanyane

Potso ea 69. 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 70. Sebopeho sa Binomial Polelo ea Bothata Fumana Sebopeho sa Binomial bakeng sa boleng bo fanoeng ba n le k. “Lithutong tsa lipalo, li-coefficients tse nang le boitsebiso bo bongata ke linomoro tse nepahetseng tse hlahang e le li-coefficients ho theorem ea binomial. Ka tloaelo, coefficient ea binomial e baloa ke linomoro tse peli n ≥ k ≥ 0 'me e ngoloa e le ”- e qotsitsoe ho Wikipedia. Mohlala n = 5, k ...

Bala haholoanyane

Potso ea 71. 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 72. 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 73. 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 74. 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 75. 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 76. 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 77. 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

Leave a Comment

Translate »