SlideShare a Scribd company logo
1 of 9
Download to read offline
Saddle Point
Definition:
1. a point on a curved surface at which the curvatures in two mutually
perpendicular planes are of opposite signs
2. a value of a function of two variables which is a maximum with respect to one
and a minimum with respect to the other
(Merriam-Webster)
Uses:
Used in industry for optimization & decision making e.g. optimal cost/profit point
In Game Theory the saddle point represents the best strategy for both players
Exercism Instructions
Detect saddle points in a given matrix where the numeric value of an element is;
• The highest value in the row and,
• The lowest value in the column
The matrix may have zero or multiple saddle points
The matrix can have a different number of rows and columns (non-square)
For example;
0 1 2
0 9 8 7
1 5 3 2
2 6 6 7
<= Saddle point at (1,0)
5 is the highest number in its row and,
5 is the lowest value in the column
Exercism Test Suite
1. new method instantiates an object of the Matrix class
2. expecting a return array of the integer series of a row
3. matrix values are given in string format with new line
character separating the rows
4. Expecting a return array of the integer series of a column
5. expecting a return array representing the coordinates of the
saddle point in the Matrix
6. has other tests for “no saddle point” and “multiple saddle
points”
Comments
Exercism Solution
attr reader for three return vales
string manipulation to split rows and elements, mapped to array of integers
transpose row to give columns
private method to return saddle point
Exercism Solution
nested loop through elements of row and column
Checks whether each element is a saddle point via private method “saddle_point?”
if element is a saddle point push to “sp” array
return the sp array
Exercism Solution
boolean expression to text whether element at give row & column is
max value in row and;
min value in colum
Exercism Full Solution
Exercism Solution Result

More Related Content

What's hot

Affine Array Indexes
Affine Array IndexesAffine Array Indexes
Affine Array IndexesNilaNila16
 
Arrays in c unit iii chapter 1 mrs.sowmya jyothi
Arrays in c unit iii chapter 1 mrs.sowmya jyothiArrays in c unit iii chapter 1 mrs.sowmya jyothi
Arrays in c unit iii chapter 1 mrs.sowmya jyothiSowmya Jyothi
 
4.1 Matrix Operations
4.1 Matrix Operations4.1 Matrix Operations
4.1 Matrix Operationshisema01
 
Merge sort data structures
Merge sort data structuresMerge sort data structures
Merge sort data structureschauhankapil
 
Matrix basic operations
Matrix basic operationsMatrix basic operations
Matrix basic operationsJessica Garcia
 
2 data types and operators in r
2 data types and operators in r2 data types and operators in r
2 data types and operators in rDr Nisha Arora
 
Chapter 3: Roots of Equations
Chapter 3: Roots of EquationsChapter 3: Roots of Equations
Chapter 3: Roots of EquationsMaria Fernanda
 
Root locus techniques
Root locus techniquesRoot locus techniques
Root locus techniquesjawaharramaya
 
Function or not function
Function or not functionFunction or not function
Function or not functionMartinGeraldine
 
0.2 Real Number Properties
0.2 Real Number Properties0.2 Real Number Properties
0.2 Real Number Propertiessmiller5
 
Day 5a iteration and functions if().pptx
Day 5a   iteration and functions  if().pptxDay 5a   iteration and functions  if().pptx
Day 5a iteration and functions if().pptxAdrien Melquiond
 

What's hot (20)

Affine Array Indexes
Affine Array IndexesAffine Array Indexes
Affine Array Indexes
 
Arrays in c unit iii chapter 1 mrs.sowmya jyothi
Arrays in c unit iii chapter 1 mrs.sowmya jyothiArrays in c unit iii chapter 1 mrs.sowmya jyothi
Arrays in c unit iii chapter 1 mrs.sowmya jyothi
 
Chap08
Chap08Chap08
Chap08
 
ARRAY
ARRAYARRAY
ARRAY
 
Lecture 2a arrays
Lecture 2a arraysLecture 2a arrays
Lecture 2a arrays
 
4.1 Matrix Operations
4.1 Matrix Operations4.1 Matrix Operations
4.1 Matrix Operations
 
Section 1.5
Section 1.5Section 1.5
Section 1.5
 
Merge sort data structures
Merge sort data structuresMerge sort data structures
Merge sort data structures
 
Matrix basic operations
Matrix basic operationsMatrix basic operations
Matrix basic operations
 
Lar calc10 ch05_sec2
Lar calc10 ch05_sec2Lar calc10 ch05_sec2
Lar calc10 ch05_sec2
 
2 data types and operators in r
2 data types and operators in r2 data types and operators in r
2 data types and operators in r
 
Chapter 3: Roots of Equations
Chapter 3: Roots of EquationsChapter 3: Roots of Equations
Chapter 3: Roots of Equations
 
Root locus techniques
Root locus techniquesRoot locus techniques
Root locus techniques
 
DATASTRUCTURES UNIT-1
DATASTRUCTURES UNIT-1DATASTRUCTURES UNIT-1
DATASTRUCTURES UNIT-1
 
Calc 4.4b
Calc 4.4bCalc 4.4b
Calc 4.4b
 
Function or not function
Function or not functionFunction or not function
Function or not function
 
0.1 Sets
0.1 Sets0.1 Sets
0.1 Sets
 
0.2 Real Number Properties
0.2 Real Number Properties0.2 Real Number Properties
0.2 Real Number Properties
 
Irahm I
Irahm IIrahm I
Irahm I
 
Day 5a iteration and functions if().pptx
Day 5a   iteration and functions  if().pptxDay 5a   iteration and functions  if().pptx
Day 5a iteration and functions if().pptx
 

Similar to Exercism Challenge - Saddle Point

Ap Power Point Chpt6
Ap Power Point Chpt6Ap Power Point Chpt6
Ap Power Point Chpt6dplunkett
 
Arrays in programming
Arrays in programmingArrays in programming
Arrays in programmingTaseerRao
 
Lec 25 - arrays-strings
Lec 25 - arrays-stringsLec 25 - arrays-strings
Lec 25 - arrays-stringsPrincess Sam
 
Module 3 - Regular Expressions, Dictionaries.pdf
Module 3 - Regular  Expressions,  Dictionaries.pdfModule 3 - Regular  Expressions,  Dictionaries.pdf
Module 3 - Regular Expressions, Dictionaries.pdfGaneshRaghu4
 
SQL for pattern matching (Oracle 12c)
SQL for pattern matching (Oracle 12c)SQL for pattern matching (Oracle 12c)
SQL for pattern matching (Oracle 12c)Logan Palanisamy
 
Data structures arrays
Data structures   arraysData structures   arrays
Data structures arraysmaamir farooq
 
Strings Arrays
Strings ArraysStrings Arrays
Strings Arraysphanleson
 
Array String - Web Programming
Array String - Web ProgrammingArray String - Web Programming
Array String - Web ProgrammingAmirul Azhar
 
Homework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdfHomework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdfaroraopticals15
 
RubyMiniGuide-v1.0_0
RubyMiniGuide-v1.0_0RubyMiniGuide-v1.0_0
RubyMiniGuide-v1.0_0tutorialsruby
 
RubyMiniGuide-v1.0_0
RubyMiniGuide-v1.0_0RubyMiniGuide-v1.0_0
RubyMiniGuide-v1.0_0tutorialsruby
 

Similar to Exercism Challenge - Saddle Point (20)

LectureNotes-05-DSA
LectureNotes-05-DSALectureNotes-05-DSA
LectureNotes-05-DSA
 
Advance excel
Advance excelAdvance excel
Advance excel
 
Ap Power Point Chpt6
Ap Power Point Chpt6Ap Power Point Chpt6
Ap Power Point Chpt6
 
Algo>Arrays
Algo>ArraysAlgo>Arrays
Algo>Arrays
 
Arrays in programming
Arrays in programmingArrays in programming
Arrays in programming
 
Unit 2
Unit 2Unit 2
Unit 2
 
Lec 25 - arrays-strings
Lec 25 - arrays-stringsLec 25 - arrays-strings
Lec 25 - arrays-strings
 
Module 3 - Regular Expressions, Dictionaries.pdf
Module 3 - Regular  Expressions,  Dictionaries.pdfModule 3 - Regular  Expressions,  Dictionaries.pdf
Module 3 - Regular Expressions, Dictionaries.pdf
 
SQL for pattern matching (Oracle 12c)
SQL for pattern matching (Oracle 12c)SQL for pattern matching (Oracle 12c)
SQL for pattern matching (Oracle 12c)
 
Introduction to Arrays in C
Introduction to Arrays in CIntroduction to Arrays in C
Introduction to Arrays in C
 
Data structures arrays
Data structures   arraysData structures   arrays
Data structures arrays
 
Strings Arrays
Strings ArraysStrings Arrays
Strings Arrays
 
Array String - Web Programming
Array String - Web ProgrammingArray String - Web Programming
Array String - Web Programming
 
Homework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdfHomework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdf
 
Ch08
Ch08Ch08
Ch08
 
RubyMiniGuide-v1.0_0
RubyMiniGuide-v1.0_0RubyMiniGuide-v1.0_0
RubyMiniGuide-v1.0_0
 
RubyMiniGuide-v1.0_0
RubyMiniGuide-v1.0_0RubyMiniGuide-v1.0_0
RubyMiniGuide-v1.0_0
 
Ppt chapter09
Ppt chapter09Ppt chapter09
Ppt chapter09
 
Array.ppt
Array.pptArray.ppt
Array.ppt
 
array.ppt
array.pptarray.ppt
array.ppt
 

Recently uploaded

WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 

Recently uploaded (20)

WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 

Exercism Challenge - Saddle Point

  • 2. Definition: 1. a point on a curved surface at which the curvatures in two mutually perpendicular planes are of opposite signs 2. a value of a function of two variables which is a maximum with respect to one and a minimum with respect to the other (Merriam-Webster) Uses: Used in industry for optimization & decision making e.g. optimal cost/profit point In Game Theory the saddle point represents the best strategy for both players
  • 3. Exercism Instructions Detect saddle points in a given matrix where the numeric value of an element is; • The highest value in the row and, • The lowest value in the column The matrix may have zero or multiple saddle points The matrix can have a different number of rows and columns (non-square) For example; 0 1 2 0 9 8 7 1 5 3 2 2 6 6 7 <= Saddle point at (1,0) 5 is the highest number in its row and, 5 is the lowest value in the column
  • 4. Exercism Test Suite 1. new method instantiates an object of the Matrix class 2. expecting a return array of the integer series of a row 3. matrix values are given in string format with new line character separating the rows 4. Expecting a return array of the integer series of a column 5. expecting a return array representing the coordinates of the saddle point in the Matrix 6. has other tests for “no saddle point” and “multiple saddle points” Comments
  • 5. Exercism Solution attr reader for three return vales string manipulation to split rows and elements, mapped to array of integers transpose row to give columns private method to return saddle point
  • 6. Exercism Solution nested loop through elements of row and column Checks whether each element is a saddle point via private method “saddle_point?” if element is a saddle point push to “sp” array return the sp array
  • 7. Exercism Solution boolean expression to text whether element at give row & column is max value in row and; min value in colum