#力扣:LCR 182. 动态口令@FDDLC

LCR 182. 动态口令

一、Java

class Solution {
    public String dynamicPassword(String password, int target) {
        return password.substring(target) + password.substring(0, target);
    }
}

二、C++

#include 
using namespace std;
class Solution {
public:
    string dynamicPassword(string password, int target) {
        return password.substr(target) + password.substr(0, target);
    }
};

三、Python

class Solution:
    def dynamicPassword(self, password: str, target: int) -> str:
        return password[target:] + password[0:target]
    

四、JavaScript

var dynamicPassword = function(password, target) {
    return password.substring(target) + password.substring(0, target);
};

五、Go

package main

func dynamicPassword(password string, target int) string {
	return password[target:] + password[0:target];
}

你可能感兴趣的:(力扣刷题:Java,C++,Python,JS,Go,leetcode,java,服务器)