This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| using System.Collections; | |
| public static class Vibration | |
| { | |
| #if UNITY_ANDROID && !UNITY_EDITOR | |
| public static AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); | |
| public static AndroidJavaObject currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity"); | |
| public static AndroidJavaObject vibrator = currentActivity.Call<AndroidJavaObject>("getSystemService", "vibrator"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //===========================================================++++++*.. | |
| // PermCheck JS solution, all grades 100%. | |
| // function solution(A) { | |
| function permCheck(A) { | |
| // write your code in JavaScript (Node.js 8.9.4) | |
| const indexMap = {}; | |
| const sum = A.reduce((a, e, i) => { | |
| indexMap[e] = true; | |
| return a - e + i + 1; | |
| }, 0); |