SlideShare a Scribd company logo
1 of 26
Download to read offline
Medium:
Maximum Level sum of a Binary Tree
Jump Game III
Minesweeper
Binary Tree Level Order Traversal
Number of operations to make network
connected
Open the lock
Hard:
Sliding Puzzle
Trapping Rain Water II
22-02-2021 Hitesh Mohapatra 1
Leetcode
22-02-2021 Hitesh Mohapatra 2
22-02-2021 Hitesh Mohapatra 3
22-02-2021 Hitesh Mohapatra 4
22-02-2021 Hitesh Mohapatra 5
22-02-2021 Hitesh Mohapatra 6
22-02-2021 Hitesh Mohapatra 7
22-02-2021 Hitesh Mohapatra 8
22-02-2021 Hitesh Mohapatra 9
22-02-2021 Hitesh Mohapatra 10
22-02-2021 Hitesh Mohapatra 11
22-02-2021 Hitesh Mohapatra 12
22-02-2021 Hitesh Mohapatra 13
1319. Number of Operations to Make Network
Connected
• There are n computers numbered from 0 to n-1 connected
by Ethernet cables connections forming a network
where connections[i] = [a, b] represents a connection
between computers a and b. Any computer can reach any
other computer directly or indirectly through the network.
• Given an initial computer network connections. You can
extract certain cables between two directly connected
computers, and place them between any pair of
disconnected computers to make them directly connected.
Return the minimum number of times you need to do this
in order to make all the computers connected. If it's not
possible, return -1.
22-02-2021 Hitesh Mohapatra 14
22-02-2021 Hitesh Mohapatra 15
22-02-2021 Hitesh Mohapatra 16
22-02-2021 Hitesh Mohapatra 17
Algorithm
• Make Adjacency List
• Find number of components by using DFS
• Find number of redundant edges
– When(Redundant edges >= component -1)
– Then (Edges required = (C-1)
Negative Case
• Edge < number of nodes -1
• Redundant edges < component-1
22-02-2021 Hitesh Mohapatra 18
752. Open the Lock
• You have a lock in front of you with 4 circular wheels. Each
wheel has 10 slots: '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'. The
wheels can rotate freely and wrap around: for example we
can turn '9' to be '0', or '0' to be '9'. Each move consists of
turning one wheel one slot.
• The lock initially starts at '0000', a string representing the
state of the 4 wheels.
• You are given a list of deadends dead ends, meaning if the
lock displays any of these codes, the wheels of the lock will
stop turning and you will be unable to open it.
• Given a target representing the value of the wheels that
will unlock the lock, return the minimum total number of
turns required to open the lock, or -1 if it is impossible.
22-02-2021 Hitesh Mohapatra 19
22-02-2021 Hitesh Mohapatra 20
Target 0202
0000 ------------------------ Initial State
0100 ------------------------1
0200 ------------------------2
0201
0210 ------------------------3
0211 ------------------------4
0212 ------------------------5
0202------------------------ 6 Target
deadends = ["0201","0101","0102","1212","2002"]
22-02-2021 Hitesh Mohapatra 21
22-02-2021 Hitesh Mohapatra 22
Algorithm
• Initiate the with 0000
• Find out potential neighbors
• Check neighbor with deadends
• Take the turn where turn != deadends
• Count the number of turn to meet the target.
Negative Side
• If initial state is == deadend ; return -1
• If all the possible moves are falls under deadends
; return -1
22-02-2021 Hitesh Mohapatra 23
773. Sliding Puzzle
• On a 2x3 board, there are 5 tiles represented by
the integers 1 through 5, and an empty square
represented by 0.
• A move consists of choosing 0 and a 4-
directionally adjacent number and swapping it.
• The state of the board is solved if and only if
the board is [[1,2,3],[4,5,0]].
• Given a puzzle board, return the least number of
moves required so that the state of the board is
solved. If it is impossible for the state of the
board to be solved, return -1.
22-02-2021 Hitesh Mohapatra 24
22-02-2021 Hitesh Mohapatra 25
22-02-2021 Hitesh Mohapatra 26

More Related Content

What's hot

C++ tokens and expressions
C++ tokens and expressionsC++ tokens and expressions
C++ tokens and expressionsNabeelaNousheen
 
Computer Organization and Assembly Language
Computer Organization and Assembly LanguageComputer Organization and Assembly Language
Computer Organization and Assembly Languagefasihuddin90
 
Floating point representation
Floating point representationFloating point representation
Floating point representationmissstevenson01
 
Water jug problem ai part 6
Water jug problem ai part 6Water jug problem ai part 6
Water jug problem ai part 6Kirti Verma
 
Computer Architecture and organization ppt.
Computer Architecture and organization ppt.Computer Architecture and organization ppt.
Computer Architecture and organization ppt.mali yogesh kumar
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notationsNikhil Sharma
 
I.BEST FIRST SEARCH IN AI
I.BEST FIRST SEARCH IN AII.BEST FIRST SEARCH IN AI
I.BEST FIRST SEARCH IN AIvikas dhakane
 
Chapter 7-Fault Tolerance.ppt
Chapter 7-Fault Tolerance.pptChapter 7-Fault Tolerance.ppt
Chapter 7-Fault Tolerance.pptHabib246314
 
Presentation on Function in C Programming
Presentation on Function in C ProgrammingPresentation on Function in C Programming
Presentation on Function in C ProgrammingShuvongkor Barman
 
CBNST PPT, Floating point arithmetic,Normalization
CBNST PPT, Floating point arithmetic,NormalizationCBNST PPT, Floating point arithmetic,Normalization
CBNST PPT, Floating point arithmetic,NormalizationAmberSinghal1
 
sparse matrix in data structure
sparse matrix in data structuresparse matrix in data structure
sparse matrix in data structureMAHALAKSHMI P
 
Computer architecture pipelining
Computer architecture pipeliningComputer architecture pipelining
Computer architecture pipeliningMazin Alwaaly
 

What's hot (20)

C++ tokens and expressions
C++ tokens and expressionsC++ tokens and expressions
C++ tokens and expressions
 
Computer Organization and Assembly Language
Computer Organization and Assembly LanguageComputer Organization and Assembly Language
Computer Organization and Assembly Language
 
Floating point representation
Floating point representationFloating point representation
Floating point representation
 
Water jug problem ai part 6
Water jug problem ai part 6Water jug problem ai part 6
Water jug problem ai part 6
 
Computer Architecture and organization ppt.
Computer Architecture and organization ppt.Computer Architecture and organization ppt.
Computer Architecture and organization ppt.
 
Python unit 3 and Unit 4
Python unit 3 and Unit 4Python unit 3 and Unit 4
Python unit 3 and Unit 4
 
Floating point arithmetic
Floating point arithmeticFloating point arithmetic
Floating point arithmetic
 
Polyphase
PolyphasePolyphase
Polyphase
 
Hardwired control
Hardwired controlHardwired control
Hardwired control
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 
I.BEST FIRST SEARCH IN AI
I.BEST FIRST SEARCH IN AII.BEST FIRST SEARCH IN AI
I.BEST FIRST SEARCH IN AI
 
Chapter 7-Fault Tolerance.ppt
Chapter 7-Fault Tolerance.pptChapter 7-Fault Tolerance.ppt
Chapter 7-Fault Tolerance.ppt
 
Presentation on Function in C Programming
Presentation on Function in C ProgrammingPresentation on Function in C Programming
Presentation on Function in C Programming
 
CBNST PPT, Floating point arithmetic,Normalization
CBNST PPT, Floating point arithmetic,NormalizationCBNST PPT, Floating point arithmetic,Normalization
CBNST PPT, Floating point arithmetic,Normalization
 
sparse matrix in data structure
sparse matrix in data structuresparse matrix in data structure
sparse matrix in data structure
 
Interrupts
InterruptsInterrupts
Interrupts
 
Semaphore
SemaphoreSemaphore
Semaphore
 
Computer arithmetic
Computer arithmeticComputer arithmetic
Computer arithmetic
 
Computer architecture pipelining
Computer architecture pipeliningComputer architecture pipelining
Computer architecture pipelining
 
File handling in c
File handling in cFile handling in c
File handling in c
 

Similar to Max Level Sum Binary Tree"TITLE"Jump Game III Minesweeper" TITLE"Binary Tree Level Order"TITLE"Network Connections Operations"TITLE"Open Number Lock"TITLE"Sliding Puzzle Water Trapping"TITLE"Leetcode Notes Hitesh Mohapatra"TITLE"Network Component Algorithm"TITLE"Open Lock Algorithm Moves" TITLE"Sliding Puzzle Moves Solve

Chapter 3. fundamentals of wan and ip routing
Chapter 3. fundamentals of wan and ip routingChapter 3. fundamentals of wan and ip routing
Chapter 3. fundamentals of wan and ip routingVishnu Vardhan
 
Student IP Addressing Tutorial.ppt
Student IP Addressing Tutorial.pptStudent IP Addressing Tutorial.ppt
Student IP Addressing Tutorial.pptjohnBronson6
 
Hurdle Race Game
Hurdle Race GameHurdle Race Game
Hurdle Race GameAsawal
 
Student subnetworkbook
Student subnetworkbookStudent subnetworkbook
Student subnetworkbookJorge Arroyo
 
Student sub network book
Student sub network bookStudent sub network book
Student sub network bookJonathan
 

Similar to Max Level Sum Binary Tree"TITLE"Jump Game III Minesweeper" TITLE"Binary Tree Level Order"TITLE"Network Connections Operations"TITLE"Open Number Lock"TITLE"Sliding Puzzle Water Trapping"TITLE"Leetcode Notes Hitesh Mohapatra"TITLE"Network Component Algorithm"TITLE"Open Lock Algorithm Moves" TITLE"Sliding Puzzle Moves Solve (8)

Subnetting
SubnettingSubnetting
Subnetting
 
Chapter 3. fundamentals of wan and ip routing
Chapter 3. fundamentals of wan and ip routingChapter 3. fundamentals of wan and ip routing
Chapter 3. fundamentals of wan and ip routing
 
Student IP Addressing Tutorial.ppt
Student IP Addressing Tutorial.pptStudent IP Addressing Tutorial.ppt
Student IP Addressing Tutorial.ppt
 
Hurdle Race Game
Hurdle Race GameHurdle Race Game
Hurdle Race Game
 
Student subnetworkbook
Student subnetworkbookStudent subnetworkbook
Student subnetworkbook
 
Student sub network book
Student sub network bookStudent sub network book
Student sub network book
 
Smart contracts
Smart contractsSmart contracts
Smart contracts
 
Ccent notes part 3
Ccent notes part 3Ccent notes part 3
Ccent notes part 3
 

More from Hitesh Mohapatra

Virtualization: A Key to Efficient Cloud Computing
Virtualization: A Key to Efficient Cloud ComputingVirtualization: A Key to Efficient Cloud Computing
Virtualization: A Key to Efficient Cloud ComputingHitesh Mohapatra
 
Automating the Cloud: A Deep Dive into Virtual Machine Provisioning
Automating the Cloud: A Deep Dive into Virtual Machine ProvisioningAutomating the Cloud: A Deep Dive into Virtual Machine Provisioning
Automating the Cloud: A Deep Dive into Virtual Machine ProvisioningHitesh Mohapatra
 
Harnessing the Power of Google Cloud Platform: Strategies and Applications
Harnessing the Power of Google Cloud Platform: Strategies and ApplicationsHarnessing the Power of Google Cloud Platform: Strategies and Applications
Harnessing the Power of Google Cloud Platform: Strategies and ApplicationsHitesh Mohapatra
 
Scheduling in Cloud Computing
Scheduling in Cloud ComputingScheduling in Cloud Computing
Scheduling in Cloud ComputingHitesh Mohapatra
 
Load balancing in cloud computing.pptx
Load balancing in cloud computing.pptxLoad balancing in cloud computing.pptx
Load balancing in cloud computing.pptxHitesh Mohapatra
 
ITU-T requirement for cloud and cloud deployment model
ITU-T requirement for cloud and cloud deployment modelITU-T requirement for cloud and cloud deployment model
ITU-T requirement for cloud and cloud deployment modelHitesh Mohapatra
 
Reviewing basic concepts of relational database
Reviewing basic concepts of relational databaseReviewing basic concepts of relational database
Reviewing basic concepts of relational databaseHitesh Mohapatra
 
Advanced database protocols
Advanced database protocolsAdvanced database protocols
Advanced database protocolsHitesh Mohapatra
 
Involvement of WSN in Smart Cities
Involvement of WSN in Smart CitiesInvolvement of WSN in Smart Cities
Involvement of WSN in Smart CitiesHitesh Mohapatra
 
Data Structure and its Fundamentals
Data Structure and its FundamentalsData Structure and its Fundamentals
Data Structure and its FundamentalsHitesh Mohapatra
 
WORKING WITH FILE AND PIPELINE PARAMETER BINDING
WORKING WITH FILE AND PIPELINE PARAMETER BINDINGWORKING WITH FILE AND PIPELINE PARAMETER BINDING
WORKING WITH FILE AND PIPELINE PARAMETER BINDINGHitesh Mohapatra
 
Basic commands for powershell : Configuring Windows PowerShell and working wi...
Basic commands for powershell : Configuring Windows PowerShell and working wi...Basic commands for powershell : Configuring Windows PowerShell and working wi...
Basic commands for powershell : Configuring Windows PowerShell and working wi...Hitesh Mohapatra
 
WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISE
WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISEWINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISE
WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISEHitesh Mohapatra
 

More from Hitesh Mohapatra (20)

Virtualization: A Key to Efficient Cloud Computing
Virtualization: A Key to Efficient Cloud ComputingVirtualization: A Key to Efficient Cloud Computing
Virtualization: A Key to Efficient Cloud Computing
 
Automating the Cloud: A Deep Dive into Virtual Machine Provisioning
Automating the Cloud: A Deep Dive into Virtual Machine ProvisioningAutomating the Cloud: A Deep Dive into Virtual Machine Provisioning
Automating the Cloud: A Deep Dive into Virtual Machine Provisioning
 
Harnessing the Power of Google Cloud Platform: Strategies and Applications
Harnessing the Power of Google Cloud Platform: Strategies and ApplicationsHarnessing the Power of Google Cloud Platform: Strategies and Applications
Harnessing the Power of Google Cloud Platform: Strategies and Applications
 
Scheduling in Cloud Computing
Scheduling in Cloud ComputingScheduling in Cloud Computing
Scheduling in Cloud Computing
 
Cloud-Case study
Cloud-Case study Cloud-Case study
Cloud-Case study
 
RAID
RAIDRAID
RAID
 
Load balancing in cloud computing.pptx
Load balancing in cloud computing.pptxLoad balancing in cloud computing.pptx
Load balancing in cloud computing.pptx
 
Cluster Computing
Cluster ComputingCluster Computing
Cluster Computing
 
ITU-T requirement for cloud and cloud deployment model
ITU-T requirement for cloud and cloud deployment modelITU-T requirement for cloud and cloud deployment model
ITU-T requirement for cloud and cloud deployment model
 
Leetcode Problem Solution
Leetcode Problem SolutionLeetcode Problem Solution
Leetcode Problem Solution
 
Trie Data Structure
Trie Data Structure Trie Data Structure
Trie Data Structure
 
Reviewing basic concepts of relational database
Reviewing basic concepts of relational databaseReviewing basic concepts of relational database
Reviewing basic concepts of relational database
 
Reviewing SQL Concepts
Reviewing SQL ConceptsReviewing SQL Concepts
Reviewing SQL Concepts
 
Advanced database protocols
Advanced database protocolsAdvanced database protocols
Advanced database protocols
 
Measures of query cost
Measures of query costMeasures of query cost
Measures of query cost
 
Involvement of WSN in Smart Cities
Involvement of WSN in Smart CitiesInvolvement of WSN in Smart Cities
Involvement of WSN in Smart Cities
 
Data Structure and its Fundamentals
Data Structure and its FundamentalsData Structure and its Fundamentals
Data Structure and its Fundamentals
 
WORKING WITH FILE AND PIPELINE PARAMETER BINDING
WORKING WITH FILE AND PIPELINE PARAMETER BINDINGWORKING WITH FILE AND PIPELINE PARAMETER BINDING
WORKING WITH FILE AND PIPELINE PARAMETER BINDING
 
Basic commands for powershell : Configuring Windows PowerShell and working wi...
Basic commands for powershell : Configuring Windows PowerShell and working wi...Basic commands for powershell : Configuring Windows PowerShell and working wi...
Basic commands for powershell : Configuring Windows PowerShell and working wi...
 
WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISE
WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISEWINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISE
WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISE
 

Recently uploaded

Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2RajaP95
 

Recently uploaded (20)

🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
 

Max Level Sum Binary Tree"TITLE"Jump Game III Minesweeper" TITLE"Binary Tree Level Order"TITLE"Network Connections Operations"TITLE"Open Number Lock"TITLE"Sliding Puzzle Water Trapping"TITLE"Leetcode Notes Hitesh Mohapatra"TITLE"Network Component Algorithm"TITLE"Open Lock Algorithm Moves" TITLE"Sliding Puzzle Moves Solve

  • 1. Medium: Maximum Level sum of a Binary Tree Jump Game III Minesweeper Binary Tree Level Order Traversal Number of operations to make network connected Open the lock Hard: Sliding Puzzle Trapping Rain Water II 22-02-2021 Hitesh Mohapatra 1 Leetcode
  • 14. 1319. Number of Operations to Make Network Connected • There are n computers numbered from 0 to n-1 connected by Ethernet cables connections forming a network where connections[i] = [a, b] represents a connection between computers a and b. Any computer can reach any other computer directly or indirectly through the network. • Given an initial computer network connections. You can extract certain cables between two directly connected computers, and place them between any pair of disconnected computers to make them directly connected. Return the minimum number of times you need to do this in order to make all the computers connected. If it's not possible, return -1. 22-02-2021 Hitesh Mohapatra 14
  • 18. Algorithm • Make Adjacency List • Find number of components by using DFS • Find number of redundant edges – When(Redundant edges >= component -1) – Then (Edges required = (C-1) Negative Case • Edge < number of nodes -1 • Redundant edges < component-1 22-02-2021 Hitesh Mohapatra 18
  • 19. 752. Open the Lock • You have a lock in front of you with 4 circular wheels. Each wheel has 10 slots: '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'. The wheels can rotate freely and wrap around: for example we can turn '9' to be '0', or '0' to be '9'. Each move consists of turning one wheel one slot. • The lock initially starts at '0000', a string representing the state of the 4 wheels. • You are given a list of deadends dead ends, meaning if the lock displays any of these codes, the wheels of the lock will stop turning and you will be unable to open it. • Given a target representing the value of the wheels that will unlock the lock, return the minimum total number of turns required to open the lock, or -1 if it is impossible. 22-02-2021 Hitesh Mohapatra 19
  • 21. Target 0202 0000 ------------------------ Initial State 0100 ------------------------1 0200 ------------------------2 0201 0210 ------------------------3 0211 ------------------------4 0212 ------------------------5 0202------------------------ 6 Target deadends = ["0201","0101","0102","1212","2002"] 22-02-2021 Hitesh Mohapatra 21
  • 23. Algorithm • Initiate the with 0000 • Find out potential neighbors • Check neighbor with deadends • Take the turn where turn != deadends • Count the number of turn to meet the target. Negative Side • If initial state is == deadend ; return -1 • If all the possible moves are falls under deadends ; return -1 22-02-2021 Hitesh Mohapatra 23
  • 24. 773. Sliding Puzzle • On a 2x3 board, there are 5 tiles represented by the integers 1 through 5, and an empty square represented by 0. • A move consists of choosing 0 and a 4- directionally adjacent number and swapping it. • The state of the board is solved if and only if the board is [[1,2,3],[4,5,0]]. • Given a puzzle board, return the least number of moves required so that the state of the board is solved. If it is impossible for the state of the board to be solved, return -1. 22-02-2021 Hitesh Mohapatra 24