Skip to content

Instantly share code, notes, and snippets.

View amixpal's full-sized avatar

Amit Pal amixpal

  • RedEye Studio
  • Seattle
View GitHub Profile
{
"CO2InGrams": 0,
"CO2EmissionsDescription": "0 gr",
"Distance": 32600,
"DistanceDescription": "32.6 km",
"Duration": 7884,
"DurationDescription": "131 min",
"CO2GramsPerKm": 0,
"CO2EmissionsGramsPerKmDescription": "0 gr/km",
"CoinsEarned": 0,
using System.Text;
class Solution {
public static string Reverse( string s )
{
char[] charArray = s.ToCharArray();
Array.Reverse( charArray );
return new string( charArray );
}
class Solution {
public string longestPalindrome(string str) {
if(str==null || str.Length==0)
return "";
int maxLength = 1;
int start = 0;
int low, high;
class Solution {
public string longestPalindrome(string A) {
if (A.Length < 2) return A;
int right = 0, left = 0, length = A.Length, maxLen = 0, maxLeft = 0;
for (int start = 0; start < length && length - start > maxLen / 2;)
{
left = start;
right = start;
while (right < length - 1 && A[right] == A[right+1])
right++;
[{
"sourceCoordinates": [23.56, 34.45],
"sourceName": "Starting Point",
"destinationCoordinates": [23.56, 34.45],
"destinationName": "Ending Point",
"id": "4444",
"startingTime": 434433,
"endTime": 344424,
"durationWithUnit": "1 Hour 45 M",
"distanceWithUnit": "34 KM",
[{
"id": "333",
"productName": "Product Name",
"imageUrl": ["google.com", "google.com"],
"priceInCoins": "23",
"productDescription": "Product Description In HTMl format",
"howToPurchase": "How to purchase in HTML Format",
"productDetail": "Detail in HTML format"
}, {
"id": "333",
func getPolylineRoute(from source: CLLocationCoordinate2D, to destination: CLLocationCoordinate2D){
let config = URLSessionConfiguration.default
let session = URLSession(configuration: config)
let url = URL(string: "https://maps.googleapis.com/maps/api/directions/json?origin=\(source.latitude),\(source.longitude)&destination=\(destination.latitude),\(destination.longitude)&key=AIzaSyCF2gjvLce5vbOWvpmU4lEPcAposSyFjGQ")!
let task = session.dataTask(with: url, completionHandler: {
(data, response, error) in
if error != nil {
@amixpal
amixpal / json
Last active September 17, 2020 14:40
{
"numberOfDays": [{
"name": "Last 7 Days",
"kpisList": [{
"value": "10",
"unit": "co2/gm"
}, {
"value": "10",
"unit": "KM"
}],
extension DashboardViewController: UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
if collectionView == durationColletionView {
return timeCollectionViewData.count
} else if collectionView == kipCollectionView {
return 6
} else {
return 3
}
import java.math.BigInteger;
public class Solution {
public String reverse(String s) {
return new StringBuilder(s).reverse().toString();
}
public String solveEven(String A) {
String firstHalf = A.substring(0,A.length()/2);
String pal;
pal = firstHalf + reverse(firstHalf);