SlideShare a Scribd company logo
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 Indexes
NilaNila16
 
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
Sowmya Jyothi
 
Chap08
Chap08Chap08
Chap08
Syam Kumar
 
ARRAY
ARRAYARRAY
ARRAY
ayush raj
 
Lecture 2a arrays
Lecture 2a arraysLecture 2a arrays
Lecture 2a arrays
Victor Palmar
 
4.1 Matrix Operations
4.1 Matrix Operations4.1 Matrix Operations
4.1 Matrix Operations
hisema01
 
Section 1.5
Section 1.5Section 1.5
Section 1.5
nscross40
 
Merge sort data structures
Merge sort data structuresMerge sort data structures
Merge sort data structures
chauhankapil
 
Matrix basic operations
Matrix basic operationsMatrix basic operations
Matrix basic operations
Jessica Garcia
 
Lar calc10 ch05_sec2
Lar calc10 ch05_sec2Lar calc10 ch05_sec2
Lar calc10 ch05_sec2
Institute of Applied Technology
 
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
Dr Nisha Arora
 
Chapter 3: Roots of Equations
Chapter 3: Roots of EquationsChapter 3: Roots of Equations
Chapter 3: Roots of Equations
Maria Fernanda
 
Root locus techniques
Root locus techniquesRoot locus techniques
Root locus techniques
jawaharramaya
 
DATASTRUCTURES UNIT-1
DATASTRUCTURES UNIT-1DATASTRUCTURES UNIT-1
DATASTRUCTURES UNIT-1
Malikireddy Bramhananda Reddy
 
Calc 4.4b
Calc 4.4bCalc 4.4b
Calc 4.4b
hartcher
 
Function or not function
Function or not functionFunction or not function
Function or not function
MartinGeraldine
 
0.1 Sets
0.1 Sets0.1 Sets
0.1 Sets
smiller5
 
0.2 Real Number Properties
0.2 Real Number Properties0.2 Real Number Properties
0.2 Real Number Properties
smiller5
 
Irahm I
Irahm IIrahm I
Irahm I
iarthur
 
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
Adrien 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

LectureNotes-05-DSA
LectureNotes-05-DSALectureNotes-05-DSA
LectureNotes-05-DSA
Haitham El-Ghareeb
 
Advance excel
Advance excelAdvance excel
Advance excel
SiddheshHadge
 
Ap Power Point Chpt6
Ap Power Point Chpt6Ap Power Point Chpt6
Ap Power Point Chpt6
dplunkett
 
Algo>Arrays
Algo>ArraysAlgo>Arrays
Algo>Arrays
Ain-ul-Moiz Khawaja
 
Arrays in programming
Arrays in programmingArrays in programming
Arrays in programming
TaseerRao
 
Unit 2
Unit 2Unit 2
Unit 2
Sowri Rajan
 
Lec 25 - arrays-strings
Lec 25 - arrays-stringsLec 25 - arrays-strings
Lec 25 - arrays-strings
Princess Sam
 
Module 3 - Regular Expressions, Dictionaries.pdf
Module 3 - Regular  Expressions,  Dictionaries.pdfModule 3 - Regular  Expressions,  Dictionaries.pdf
Module 3 - Regular Expressions, Dictionaries.pdf
GaneshRaghu4
 
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
 
Introduction to Arrays in C
Introduction to Arrays in CIntroduction to Arrays in C
Introduction to Arrays in C
Thesis Scientist Private Limited
 
Data structures arrays
Data structures   arraysData structures   arrays
Data structures arrays
maamir farooq
 
Strings Arrays
Strings ArraysStrings Arrays
Strings Arrays
phanleson
 
Array String - Web Programming
Array String - Web ProgrammingArray String - Web Programming
Array String - Web Programming
Amirul 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 .pdf
aroraopticals15
 
Ch08
Ch08Ch08
RubyMiniGuide-v1.0_0
RubyMiniGuide-v1.0_0RubyMiniGuide-v1.0_0
RubyMiniGuide-v1.0_0
tutorialsruby
 
RubyMiniGuide-v1.0_0
RubyMiniGuide-v1.0_0RubyMiniGuide-v1.0_0
RubyMiniGuide-v1.0_0
tutorialsruby
 
Ppt chapter09
Ppt chapter09Ppt chapter09
Ppt chapter09
Richard Styner
 
Array.ppt
Array.pptArray.ppt
Array.ppt
SbsOmit1
 
array.ppt
array.pptarray.ppt
array.ppt
rajput0302
 

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

GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
Zilliz
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 

Recently uploaded (20)

GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 

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