Git Product home page Git Product logo

rajithap88's Projects

arrays icon arrays

Professor Clinton is given a sorted integer array. He needs to make the array elements distinct by increasing each value as needed, while minimizing the array sum. Professor Clinton thought this was an interesting exercise that the students might enjoy completing. Your job is to complete the method to print the minimum possible sum as output. Example : Input : arr[] = {2,2,3,5,6}; Output: 20 Explanation: Array is transformed to {2,3,4,5,6}. Sum becomes 2+3+4+5+6=20 Input arr[]= {40,40}; Output: 81 Explanation: Array is transformed to {40,41}. Sum becomes 81 Input: arr[] = {4,5,6,9}; Output : 24 Explanation: As the array is sorted and has distinct elements. So result is sum of each elements in the array. Time Complexity: O(n)

is_608 icon is_608

Coursework for 608 Knowledge and Visual Analytics, MS in Data Analytics at CUNY SPS

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.