Skip to content

Basic programming challenges. It helps to improve our coding skills

License

Notifications You must be signed in to change notification settings

albin-joseph/programming_challenges

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OverView

My intention for this repo is to do and showcase some programming challenges. I think it may help the new programmers and also who is trying to learn programs. I am welcomming your contributions also. Now I am doing this programming challenges in swift. You can expect the same implementation in different langages like c, c++, js etc

challenges

Total number of pairs in an array Write a function to accept an integer array. Write a logic to find out the total number of pair numbers in the array.

  • expectation:

      func findTotalPairs(ar: [Int]) -> Int
    • input: a = [1, 2, 3, 4, 3, 2, 1]
    • output: 3
  • constraints:

    • 0 < ar.count <= n

    refer the code

Find the minimum absolute length between the two elements in an array An array contains a number of strings, it may repeat. Write an algorithm to find out the minimum absolute length between the two strings.

  • expectation:

      func getMinimumDistance(_ strArray: [String], _ firstString: String, _ secondString: String) -> Int
    • input: strArray = ["Apple", "Apple", "Staberry", "Plum","Mango", "Tomato", "Magostine", "Mango", "Apple"], firstString = "Mango", secondString = "Apple"
    • output: 1

    refer the code

Find the unique and common item from two array of keyvalue pairs An array contains dictionries, dictionary contains two keys name and id. But at the time of copmarison yiu have to consider the name only

  • expectation:

      func getMinimumDistance(_ strArrlet a ay: [String], _ firstString: String, _ secondString: String) -> Int
    • input: let a = [["id":"1","name":"Albin"],["id":"2","name":"Anu"],["id":"3","name":"Arsha"]], let b = [["id":"1","name":"Albin"],["id":"2","name":"Anu"]]
    • output: common: [["id": "1", "name": "Albin"], ["name": "Anu", "id": "2"]], unique:[["id": "3", "name": "Arsha"]]

    refer the code

Releases

No releases published

Packages

No packages published

Languages