Skip to content

Instantly share code, notes, and snippets.

@Ch-sriram
Created October 12, 2020 01:10
Show Gist options
  • Save Ch-sriram/f2a855b6ed16229f07599f95bf30bb8c to your computer and use it in GitHub Desktop.
Save Ch-sriram/f2a855b6ed16229f07599f95bf30bb8c to your computer and use it in GitHub Desktop.
Series AP [TC: O(1); SC: O(1)]
// Problem Link: https://practice.geeksforgeeks.org/problems/series-ap5310/1
int nthTermOfAP(int A1, int A2, int N) { return A1 + (N-1) * (A2-A1); }
@Ch-sriram
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment