From 9ed89775495f4f0f0a8176fed01aa844cc387120 Mon Sep 17 00:00:00 2001 From: bhumikahaldiya <84183734+bhumikahaldiya@users.noreply.github.com> Date: Fri, 24 Oct 2025 10:55:03 +0530 Subject: [PATCH] Create FixedPointArray.cpp --- FixedPointArray.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 FixedPointArray.cpp diff --git a/FixedPointArray.cpp b/FixedPointArray.cpp new file mode 100644 index 00000000..b5d48b26 --- /dev/null +++ b/FixedPointArray.cpp @@ -0,0 +1,20 @@ +// C++ program to check fixed point +// in an array using linear search +#include +using namespace std; + +int fixedPoint(vector &arr) { + for (int i = 0; i < arr.size(); i++) { + if (arr[i] == i) + return i; + } + + // If no fixed point is found + return -1; +} + +int main() { + vector arr = { -10, -5, 0, 3, 7}; + cout<